(defun foo (in out process-sexpr)
"Read s-expressions from the stream IN, process them one by one using the function PROCESS-SEXPR and print the results to the steram OUT."
(do ((sexpr (read in nil :eof) (read in nil :eof)))
((eq sexpr :eof))
(print (funcall process-sexpr sexpr) out)))
;;; Example: send all the s-exprs from a file to stdout.
(with-open-file (in "test.txt")
(foo in t #'identity))
Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests