2
\$\begingroup\$

I have written a Common Lisp implementation of Scheme's s-expression comments (SRFI 62):

(eval-when (:compile-toplevel
 :load-toplevel
 :execute)
 (defun handle-s-expression-comment (stream char n)
 (declare (ignore char))
 (when n
 (error "Infix parameter not allowed in s-expression comment."))
 (read stream) ; Discard the next s-expression.
 (values))
 (set-dispatch-macro-character #\# #\; #'handle-s-expression-comment))

With s-expression comments:

  • (+ 1 #;(* 2 3) 4) returns 5
  • (list 'x #;'y 'z) returns (x z)
  • (* 3 4 #;(+ 5 6)) returns 12
  • (#;sqrt abs -123) returns 123

Is my implementation correct? What improvements can I make?

asked Apr 2, 2021 at 17:27
\$\endgroup\$
1

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.