1 / 5
Oct 2004

(loop
 (let ((a (read)))
   (when (= a 42) (return))
   (princ (format nil "~D~%" a))))
  • created

    Oct '04
  • last reply

    Sep '11
  • 4

    replies

  • 1.4k

    views

  • 5

    users

2 years later

[quote="noix"]

(loop
 (let ((a (read)))
   (when (= a 42) (return))
   (princ (format nil "~D~%" a))))

[/quote]

(read) contains the whole lisp processor! It is extremely slow solution. Give me a break, you give non-lisp users an odd.

(loop for l = (read-line)
      for n = (parse-integer l)
      until (= n 42) do (format t "~D~%" n))
1 month later

(do
 ((x (read-line) (read-line)))
 ((string= x "42"))
  (format t "~a~&" x))
4 years later

huh? These programs looks correct. And AC with clisp, but runtime error with sbcl... Why is that?