In Common Lisp, there are obviously some special characters that act as shortcuts for certain forms. 'x
means (quote x)
. #'f
means (function f)
. I had thought those (as well as backtick) were the only ones, but then I learned about #()
, which is apparently a vector, and just today someone mentioned #.
, which apparently does something with evaluation time.
Try as I might, I can't seem to find a comprehensive list of which prefix symbols mean something and what they do? Is this something that's left to the implementation to decide, or could someone point me to somewhere in the standard that lists these shortcuts comprehensively?
A Lisp symbol is a data object that has three user-visible components: The property list is a list that effectively provides each symbol with many modifiable named components. The print name must be a string, which is the sequence of characters used to identify the symbol.
Common Lisp has a complete and flexible type system and corresponding tools to inspect, check and manipulate types. It allows creating custom types, adding type declarations to variables and functions and thus to get compile-time warnings and errors.
A special form is a primitive function specially marked so that its arguments are not all evaluated. Most special forms define control structures or perform variable bindings—things which functions cannot do. Each special form has its own rules for which arguments are evaluated and which are used without evaluation.
SPC k opens the lisp state menu, providing commands for structural editing with Smartparens. Any command will put the current buffer into lisp state, a transient state where you can use single character keybindings for the commands (no need to use SPC k each time).
The HyperSpec, in 2.4 Standard Macro Characters, enumerates "the macro characters defined initially in a conforming implementation". You can define your own using set-macro-character, which handles the types like '
which have no "prefix" to them, and set-dispatch-macro-character, which handles the type that are prefixed by a dispatch character (typically #
).
In addition to the HyperSpec, you may find Chapter 17, Read Macros from Paul Graham's On Lisp helpful. It begins with an implementation of '
, i.e., the macro character that expands to (quote ...)
. Answers to How to define symbols that will work like ( and ) by symbol macro? are also helpful, as there are some uses of set-macro-character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With