The less-familiar parts of Lisp for beginners — readtable-case

Now we examine the accessor readtable-case.  This feature reads or sets the upper/lower case behaviour of a readtable.  That behaviour affects how symbol names are generated from an input stream.

For instance, the startup readtable-case for the standard readtable in SBCL is :UPCASE.  If the REPL is given as input the string Hello, the symbol generated is HELLO.

Other possible behaviours are :DOWNCASE, :PRESERVE, and :INVERT.  The first two are self-explanatory.  The third one preserves the case for mixed-case strings, but inverts it for single-case strings.  So Hello remains Hello, while HELLO becomes hello and hello becomes HELLO.  This :INVERT behaviour is not seen in keyword symbols in SBCL 1.1.14:  :HELLO remains :HELLO.

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.