Skip to content

Instantly share code, notes, and snippets.

@cwfoo
Last active April 15, 2022 20:30
Show Gist options
  • Save cwfoo/2a03a1db0b9c1bdfc17b3da2b50f5d59 to your computer and use it in GitHub Desktop.
Save cwfoo/2a03a1db0b9c1bdfc17b3da2b50f5d59 to your computer and use it in GitHub Desktop.
Reader macro that implements Scheme's SRFI 62 S-expression comments in Common Lisp
;;;; Reader macro that implements Scheme's SRFI 62 S-expression comments in Common Lisp.
;;;; SRFI 62: https://srfi.schemers.org/srfi-62/srfi-62.html
;;;; Adapted from: https://stackoverflow.com/questions/69248229/reads-recursive-p-argument-when-used-inside-a-reader-macro
(eval-when (:compile-toplevel :load-toplevel :execute)
(set-dispatch-macro-character #\# #\;
(lambda (stream char n)
(declare (ignore char))
(when n
(error "No number allowed between # and ;"))
(read stream t nil t) ; Discard the S-expression.
(values))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment