The less-familiar parts of Lisp for beginners — set-macro-character

The set-macro-character function allows the programmer to modify the readtable.  We’ve talked a bit about modifying the readtable before, in the article on get-dispatch-macro-character.  For a simple example of the use of this function, see the earlier article on eval-when.

There’s not much else to mention here, apart from explaining the difference between a terminating and non-terminating macro character.  One of the optional arguments to set-macro-character allows the programmer to declare that the macro character is non-terminating.  A non-terminating macro character that appears in the middle of a token does not end the token, it only has its special readtable behaviour when it appears at the beginning of a token.  A terminating macro character, conversely, cannot appear as part of a token, because it performs its action when encountered, even inside a symbol name.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

反垃圾邮件 / Anti-spam question * Time limit is exhausted. Please reload CAPTCHA.