[ Introduction | 1.2 - Comments ]
Parentheses
Nujel uses the S-Expression notation as used by languages such as Lisp, Scheme and Clojure, but with one difference: Nujel defaults to using brackets instead of parentheses. This is mainly because brackets are much easier to type with a default US keyboard layout. You can still use parentheses if you must, since the two are completely interchangeable.
[+ 1 2] ; => 3
(+ 1 2) ; => 3
Dotted pairs are also supported:
[car '[a . b]] ; => a
[cdr '[a . b]] ; => b
[car [cons 1 2]] ; => 1
[cdr [cons 1 2]] ; => 2
And as you can see Nujel uses car and cdr to access the first or rest parts of lists. To build a new pair you can use cons.
[ Introduction | 1.2 - Comments ]