blob: f317f10e4bfec348130c78d75258d9d3b8106c6e [file] [log] [blame]
swissChilie9fec8b2021-06-22 13:59:33 -07001Lisp Standard Library
2=====================
3
4This provides documentation for every built-in function in the Lisp standard
5library. It is not auto-generated, please update this documentation if you
6change the API in any way.
7
8In general every user-facing API in the standard library should be documented
9here.
10
swissChili5500f702021-06-30 22:11:17 -070011Functions
12---------
swissChilie9fec8b2021-06-22 13:59:33 -070013
14.. function:: (if condition true-condition [false-condition])
15
16 Evaluates ``condition``, if it is truthy (non-``nil``) ``true-condition`` is
17 evaluated. Otherwise ``false-condition`` is evaluated. If
18 ``false-condition`` is not provided, ``if`` will evaluate to ``nil``.
19
20.. function:: (let1 (variable binding) & body)
21
22 Evaluates ``binding`` and binds it to ``variable``, then evaluates ``body``.
23 After ``body`` is evaluated ``variable`` is unbound.
24
25 .. code-block:: lisp
26
27 (let1 (greeting (greet "John"))
28 (do-something greeting)
29 (print greeting))
30 ; greeting is no longer bound
31
32.. function:: (gc)
33
34 Force the garbage collector (GC) to run.
35
swissChilie9fec8b2021-06-22 13:59:33 -070036.. function:: (car pair)
37
38 Return the first item in ``pair``.
39
40.. function:: (cdr pair)
41
42 Return the second (last) item in ``pair``.
43
44.. function:: (cons a b)
45
46 Return a cons-pair containing ``a`` and ``b``.
47
48.. function:: (print val)
49
50 Print out ``val`` to standard output. This will not be formatted as an
swissChili5500f702021-06-30 22:11:17 -070051 s-expression, but in a manner more similar to the internal representation.
52
53.. function:: (list & items)
54
55 Returns a cons-list of items.
56
57.. function:: (quote form)
58
59 Returns form without evaluating it.
60
61 .. code-block:: lisp
62 '(cons a b)
63
64 '(cons a b)
65 ; or
66 (quote cons a b)
67 ; is the same as
68 (list 'cons 'a 'b)