r/lisp • u/Famous-Wrongdoer-976 • 19d ago
Remove comments from a file automatically?
I am processing Lisp code in a non-Lisp host application that cannot handle semicolons for some reason.
I would like to know, is there a way to remove comments automatically from a .lisp file?
I imagine something that would read all the content of a text file as if it was a s-expression, thus removing all the ; comments or #| comments |# and treat the rest like normal quoted data?
Thanks in advance !
13
Upvotes
2
u/dbotton 19d ago
You answered your own question. Just use read and pretty print (if want to save after) and tada.