入门
语法
Lisp 语法非常简单:有很少的规则需要记住。
语法由S-表达式构成。S-表达式要么是原子,要么是列表。
原子可以是如 10
、3.14
的数字,或如 t
(真常量)、+
、my-variable
的符号。还有一种叫做关键字的特殊类型的符号,它们是冒号前缀符号,如 :thing
或 :keyword
。关键字自己求值:你可以把它们当做枚举类型类似的东西。
你好,世界!
毫不迟疑
CL-USER> (format t "Hello, world!")
Hello, world!
NIL
注释
;; Single line comments start with a semicolon, and can start at any point in the line
#|
This is a multi-line comment.
#|
They can be nested!
|#
|#