引用
报价与大小写无关。 quote 阻止评估。
引用一个符号:
CL-USER 1 > 'foo
FOO
引用列表:
CL-USER 2 > '(1 2 3 foo)
(1 2 3 FOO)
你可以在很多东西前面加上引号。比如前面一个字符串:
CL-USER 3 > '"a b c"
"a b c"
由于字符串对自身进行评估,因此是否引用它们没有区别:
CL-USER 4 > "a b c"
"a b c"
符号默认为大写:
CL-USER 5 > 'FooBar
FOOBAR
CL-USER 6 > (symbol-name 'FooBar)
"FOOBAR"
但这与引用无关,是阅读器的一个功能。
CL-USER 7 > (read-from-string "foo")
FOO
3
小写
如果你想要小写的字符串,你需要将字符串转换为小写:
CL-USER 8 > (string-downcase (symbol-name 'FooBar))
"foobar"
混合大小写的符号
但是您可以创建具有小写名称或混合大小写的符号。你需要逃避它们:
CL-USER 9 > '|This is a symbol With spaces and mixed case|
|This is a symbol With spaces and mixed case|
CL-USER 10 > 'F\o\oB\a\r
|FooBar|
使用FORMAT 缩小输出
您也可以告诉FORMAT 以小写形式打印:
CL-USER 11 > (format nil "The value is: ~(~a~)" 'foo)
"The value is: foo"