Error Question

13 views
Skip to first unread message

Brian Parker

unread,
May 4, 2023, 9:57:03 AM5/4/23
to BiwaScheme
Hello all,

I recently stumbled across BiwaScheme and I am enamoured by the whole initiative!  I would love to use it at home and at work, but I keep getting an error that says found EOS in list: "(display (append lst '(3 4))\n\n\n\n\n" [] with the following basic code...

The cons seems to be working.
I very well could be doing this all wrong, please advise.

<!DOCTYPE html>
<html>
<body>
<div id="bs-console"></div>
<script src="biwascheme-0.8.0.js"></script>
<script type="text/biwascheme">


(define lst (list 1 2))

(display (append lst '(3 4))




</script>
</body>
</html>

Yutaka Hara

unread,
May 4, 2023, 10:08:48 AM5/4/23
to biwas...@googlegroups.com
Hello,

2023年5月4日(木) 22:57 Brian Parker <brian3...@gmail.com>:
Hello all,

I recently stumbled across BiwaScheme and I am enamoured by the whole initiative!  I would love to use it at home and at work, but I keep getting an error that says found EOS in list: "(display (append lst '(3 4))\n\n\n\n\n" [] with the following basic code...

This error happens when a closing paren is missing. Check that all '(' has corresponding ')'.


The cons seems to be working.
I very well could be doing this all wrong, please advise.

<!DOCTYPE html>
<html>
<body>
<div id="bs-console"></div>
<script src="biwascheme-0.8.0.js"></script>
<script type="text/biwascheme">


(define lst (list 1 2))

(display (append lst '(3 4))




</script>
</body>
</html>

--
You received this message because you are subscribed to the Google Groups "BiwaScheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biwascheme+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/biwascheme/87f47652-3221-4f75-8eba-c1b609dae71an%40googlegroups.com.

Brian Parker

unread,
May 4, 2023, 10:13:17 AM5/4/23
to biwas...@googlegroups.com
Hello Mr. Hara,

Thank you for your swift response!  And how embarrassing…  A missing parenthesis was the culprit!  

I will continue to explore BiwaScheme and scheme in generally, hopefully becoming able to contribute to this wonderful endeavor myself some day.  

Sincerely,

Brian

2023年5月4日(木) 23:08 Yutaka Hara <yutak...@gmail.com>:

Mark Friedman

unread,
May 4, 2023, 1:10:21 PM5/4/23
to biwas...@googlegroups.com
Brian,

  You don't have enough closing parentheses in "(display (append lst '(3 4))".

-Mark 

--

Brian Parker

unread,
May 4, 2023, 10:33:55 PM5/4/23
to biwas...@googlegroups.com
Thank you Mark!  Yes, it was a silly / embarrassing mistake...

Please allow me one additional question.
I checked the List of Functions page on the homepage, but none were listed for "Port (I/O)".
Does BiwaScheme lack I/O primitives?

Thank you everyone for all your help.

Sincerely,

Brian

Yutaka Hara

unread,
May 5, 2023, 1:43:36 AM5/5/23
to biwas...@googlegroups.com
2023年5月5日(金) 11:33 Brian Parker <brian3...@gmail.com>:
Thank you Mark!  Yes, it was a silly / embarrassing mistake...

Please allow me one additional question.
I checked the List of Functions page on the homepage, but none were listed for "Port (I/O)".
Does BiwaScheme lack I/O primitives?

Oh maybe I forgot to fill that part...

Here you can find the list of implemented IO procedures.

Brian Parker

unread,
May 5, 2023, 1:56:58 AM5/5/23
to biwas...@googlegroups.com
Thank you!  I will check the github page instead of the website for the latest info.
Best,
--Brian

Brian Parker

unread,
May 5, 2023, 3:26:26 AM5/5/23
to biwas...@googlegroups.com
Third and final question--I'm sorry for asking so many in probably the wrong place...

I could not spot a function to search a string.  Is there such a primitive function? (E.g. substring? as in other schemes)

Thank you for all the generous support,

Brian

Brian Parker

unread,
May 5, 2023, 4:40:02 AM5/5/23
to biwas...@googlegroups.com
PS, for what its worth, I did try to write a string search function myself, but I kept getting #f for some reason I can't figure out.
(Sorry for the cryptic argument names...)

(define (string-search item source)
  (rc-string-search item source 0))

(define (rc-string-search item source c)
  (cond ((string<? item source) #f)
        ((string=?
           (substring source
                      0
                      (string-length item))
           item)
         c)
        (#t (rc-string-search
              item
              (substring
                source 1 (string-length source))
              (+ c 1)))))

(define test "This is a test.")

(display (string-search "is" test))
(newline)

Sudarshan S Chawathe

unread,
May 5, 2023, 9:13:59 AM5/5/23
to biwas...@googlegroups.com
I believe there's a logic error in the rc-string-search procedure. For
example, think about what happens with

(rc-string-search "is" "is a test." 0)

Regards,

-chaw

Brian Parker

unread,
May 5, 2023, 10:09:57 AM5/5/23
to biwas...@googlegroups.com
Hello Chaw and friends,
Thank you for the guidance!
You were right--I had misunderstood the string<? procedure.
I have re-worked as follows, and it seems to work!
I will stay signed up to the mailing list and help answer future questions from others.
Sincerely,
--Brian
===string-search===
(define (string-search item source)
  (rc-string-search item source 0))

(define (rc-string-search item source c)
  (cond ((< (string-length source) (string-length item)) #f)

        ((string=?
           (substring source
                      0
                      (string-length item))
           item)
         c)
        (#t (rc-string-search
              item
              (substring
                source 1 (string-length source))
              (+ c 1)))))
===end===

--
You received this message because you are subscribed to the Google Groups "BiwaScheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biwascheme+...@googlegroups.com.

Brian Parker

unread,
May 9, 2023, 3:16:42 AM5/9/23
to biwas...@googlegroups.com
Hello friends,

I tried using a blob to create a file with output.  The same code works as javascript, but I get an error "link is not defined [js-eval]" when I try to run it using the biwascheme (js-eval) process as below.  Any thoughts on how to get the output of one's scheme code as a text file?

(js-eval "const blob = new Blob(['aeiou'], {type:'text/plain'});")
(js-eval "const link = document.createElement('a');")
(js-eval "link.href = URL.createObjectURL(blob);")
(js-eval "link.download = 'test.txt';")
(js-eval "link.click();")

Yutaka Hara

unread,
May 10, 2023, 10:55:35 AM5/10/23
to biwas...@googlegroups.com
The code passed to js-eval cannot refer to variables defined in previous js-eval's. So this should work as you expected:

(js-eval "
  const blob = new Blob(['aeiou'], {type:'text/plain'});
  const link = document.createElement('a');
  link.href = URL.createObjectURL(blob);
  link.download = 'test.txt';
  link.click();
")

2023年5月9日(火) 16:16 Brian Parker <brian3...@gmail.com>:


--
原 悠
Yutaka HARA

Brian Parker

unread,
May 11, 2023, 9:39:22 AM5/11/23
to biwas...@googlegroups.com
Dear Mr. Hara,

That did the trick!  Thank you so much for taking the time to answer again a basic question.  I'm working on getting a text file in with input and another text file out with output.

Sincerely,

Brian

Reply all
Reply to author
Forward
0 new messages