3 ms·
Well, Lisp has a lot of syntax. It just looks and works different. For example the syntax of IF is: if test-form then-form [else-form] Examples: (if
by lispm 12y ago
Well, Lisp has a lot of syntax. It just looks and works different. For example the syntax of IF is:
if test-form then-form [else-form]
Examples:
(if foo 1 2)
(if foo 1)
That means: after IF there are exactly two or three expressions.
LET looks more complicated:
let ({var | (var [init-form])}*) declaration* form*
Example:
(let ((foo 10) bar)
(declare (integer foo))
(setq bar foo)
foo)
Note, the notation with parentheses is not the syntax of the Lisp programming language, but of symbolic expressions. The Lisp syntax is defined on top of s-expressions. Not every s-expression is a valid Lisp program.
For example the following are not valid Lisp expressions, but still valid s-expressions:
(if foo 1 2 (3) (4))
(let a (declare (integer 10)) 3 + a)