Common Lisp Special Shortcut Characters

There are obviously some special characters in Common Lisp that act as shortcuts for certain forms. 'x means (quote x) . #'f means (function f) . I thought that those (as well as the reverse) were the only ones, but then I found out about #() , which, apparently, is a vector, and only today someone mentioned #. which, apparently, does something with the evaluation time.

Try it, as I could, I can’t find an exhaustive list, what prefix characters mean something and what do they do? Is this something that remains of the implementation, or can someone point me somewhere in the standard that lists these labels comprehensively?

+6
source share
2 answers

HyperSpec, in 2.4 Standard Macro Characters , lists "macros defined initially in the corresponding implementation." You can define your own using set-macro-character , which processes types of type ' that don't have a β€œprefix” for them, and set-dispatch-macro-character , which processes types that are prefixed with a send character (usually # ).

In addition to HyperSpec, you can find Chapter 17, Reading Macros from Paul Graham On Lisp useful. It starts with the implementation of ' , that is, a macro character that extends to (quote ...) . Answers to How to identify characters that will work as (and) a character macro? are also useful since there are some uses for set-macro-character .

+9
source

What you are looking for, Standard Macros .

You can define your own using set-dispatch-macro-character and set-macro-character .

In fact, this is how I implemented XML Parsing .

+4
source

Source: https://habr.com/ru/post/981078/


All Articles