3 ms·
#+foo A B This says if the Lisp supports “foo” as a “feature” (a precise term in Common Lisp), the A will be included. Otherwise A will be treated as a comment
by reikonomusha 6y ago
#+foo A B
This says if the Lisp supports “foo” as a “feature” (a precise term in Common Lisp), the A will be included. Otherwise A will be treated as a comment. B will be included regardless. It’s roughly equivalent to
#ifdef foo
A
#endif
B
The opposite is #-.
#-unix A B
is roughly
#ifndef unix
A
#endif
B
So you can write portable source code this way.
(defvar path-separator
#+unix "/"
#+windows "\\"
#-(or unix windows) (error "idk"))
This will define a variable called PATH-SEPARATOR which is / for UNIX, \ for Windows, and a compile-time error otherwise.
The rabbit hole goes deep on this. There’s a reason it uses ‘#’, and as you pointed out, it has to do with built-in (dispatching) reader macros.