[Openmcl-devel] make-symbol with uppercase/lowercase strings -- vertical bars or backslashes?

Joshua TAYLOR joshuaaaron at gmail.com
Mon Jan 14 14:06:52 PST 2013


On Mon, Jan 14, 2013 at 4:18 PM, Dave Cooper <david.cooper at genworks.com> wrote:
> Does anyone know if there any predictability to this behavior in CCL?:
>
>  CL-USER> (make-symbol "heynow")
> #:|heynow|
> CL-USER> (make-symbol "heyNow")
> #:|heyNow|
> CL-USER> (make-symbol "HeyNow")
> #:|HeyNow|
> CL-USER> (make-symbol "HEYNow")
> #:|HEYNow|
> CL-USER> (make-symbol "HEYnOW")
> #:HEY\nOW
> CL-USER> (make-symbol "HEYnoW")
> #:|HEYnoW|
> CL-USER> (make-symbol "HEYnoW")
> #:|HEYnoW|
> CL-USER> (make-symbol "HEYNoW")
> #:HEYN\oW
> CL-USER> (make-symbol "HEYnOW")
> #:HEY\nOW
> CL-USER> (make-symbol "HeYnOW")
> #:|HeYnOW|
> CL-USER>

While a symbol can be printed in lots of different but equivalent ways

? (eq 'hey\now '|HEYnOW|)
T

it looks like CCL prints in a sort of minimal format.  If only one
character would be escaped, it seems to print the individual escape
(requiring two characters: #\\ and the character).  If more than
character is a special case, then using the |...| notation requires
only two extra characters (the initial and final #\|).  The printing
will also depend on the readtable-case of the readtable:

? (make-symbol "heynow")
#:|heynow|
? (setf (readtable-case *readtable*) :downcase)
:|DOWNCASE|
? (|MAKE-SYMBOL| "heynow")
#:heynow

//JT

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/



More information about the Openmcl-devel mailing list