I just signed up & submitted the following solution to the very first problem (LIfe, the universe & everything):
(do
((i (read) (read)))
((= i 42) '())
(begin
(display i)
(newline)))
This works fine if I run it in Chicken Scheme on my own machine, but it is rejected as incorrect by spoj. If I look at the details of the submission, it seems to think that it doesn't stop when 42 is entered. I tried changing the code to:
(do
((i (read) (read)))
((= i 42) (quit))
(begin
(display i)
(newline)))
in case the interpreter wasn't exiting (and the REPL was continuing to evaluate input as displayable atoms or something?) but this doesn't seem to help.
I had hoped to use spoj to improve my Scheme programming, but this isn't the best start!
Does anybody have any ideas as to what I might be doing wrong?
created
last reply
- 1
reply
- 984
views
- 1
user