- Code: Select all
(defun main ()
(let ((x (read-line (standard-input))))
(format (standard-output) "Read ~A~%" x)))
doesn't wait for input and just prints "Read". Is OpenLisp supposed to work this way?
(defun main ()
(let ((x (read-line (standard-input))))
(format (standard-output) "Read ~A~%" x)))
100(+ 1 2)
? 100CR/LF
= 100
? (main)CR/LF
#!/usr/bin/env uxlisp -shell
(defun input-h (s)
(let ((c (read-byte (standard-input) nil nil)))
(format (error-output) "input-h: c ~S~%" c)
(cond ((eq c 10) s)
((eq c nil) (error "empty stream"))
(t (input-h (cons c s))))))
(defun input ()
(input-h (string-append (reverse (input-h '())))))
(defun process-line (l)
(format (standard-output) "~A~%" l))
(defun main ()
(for ((line (input) (input)))
((null line))
(process-line line)))
(main)
firef$ cat input.txt | ./echo.lsp
input-h: c 10
input-h: c nil
** Error reading file '"./echo.lsp"' at (or before) line 16.
empty streamFatal error.
firef$
Users browsing this forum: No registered users and 2 guests