keithlisp/doc/stdlib_forms.md

23 lines
727 B
Markdown
Raw Normal View History

2021-09-23 13:51:39 +00:00
# Special Forms
Special forms are constructs that Keithlisp evaluates differently from
other S-expressions.
## `quote`
```
quote form
```
`quote` returns `form` as-is, without performing any evaluation on it.
## `cond`
```
cond {(test {body-form}*)}*
```
`cond` is Keithlisp's basic conditional operator. It consists of zero or
more clauses (a `test`, followed by zero or more `body-form`s).
`cond` evaluates the `test` of each clause in order. If the result is
non-nil, `cond` skips all remaining clauses, evaluates each `body-form`,
and returns the result of the last one (or the result of `test` if the
clause has no `body-form`s). Otherwise, if all `test`s evaluate to nil,
or no clauses were given, `cond` returns nil.