hi.
What is the best way to substitute s-exprs in a file?
For example: (a b c) -> (b (a a) something c), no matter how the expression is formatted.
(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))
pjstirling wrote:Won't that a) lose comments and extra whitespace... ?
Users browsing this forum: No registered users and 10 guests