summaryrefslogtreecommitdiff
path: root/topics/lisp
diff options
context:
space:
mode:
authorjgart2022-02-02 00:36:23 -0500
committerjgart2022-02-02 00:39:10 -0500
commita759b18abc4decd0fb03b41cee72dbe1f3ee6436 (patch)
tree0dc41e80a8371c84220325249c1ebe05b00bcc2b /topics/lisp
parent77896016cb401c4edd3b07b04c59f56c48f2f158 (diff)
downloadgn-gemtext-a759b18abc4decd0fb03b41cee72dbe1f3ee6436.tar.gz
lisp: tips-and-tricks: defining a scheme sexp comment with a reader macro
Diffstat (limited to 'topics/lisp')
-rw-r--r--topics/lisp/tips-and-tricks.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/topics/lisp/tips-and-tricks.scm b/topics/lisp/tips-and-tricks.scm
new file mode 100644
index 0000000..792980b
--- /dev/null
+++ b/topics/lisp/tips-and-tricks.scm
@@ -0,0 +1,16 @@
+# Defining a scheme sexp comment with a reader macro
+
+=> http://clhs.lisp.se/Body/f_set__1.htm SET-DISPATCH-MACRO-CHARACTER
+
+```
+CL-USER(1): (set-dispatch-macro-character #\# #\; (lambda (s c n) c n (read s t nil t) (values)))
+
+CL-USER(2): (+ 3 (+ 2 3) 1)
+
+9
+CL-USER(3): (+ 3 #;(+ 2 3) 1)
+
+4
+```
+
+Special thanks to Ed Langley on #common-lisp:matrix.org.