-
Notifications
You must be signed in to change notification settings - Fork 2
operator
TurtleKitty edited this page May 18, 2017
·
1 revision
An operator is a procedure that runs at compile time.
It operates on source code rather than values.
Operators can be used to create new syntax.
New operators are created by the op operator.
Many core operators - such as when, cond, case, let, for, and while - are defined in terms of more primitive ones.
(op when (pred)
%(if $pred
(seq @rest)
null))
Operators, like procedures...
...close over their current lexical environment
...have an implied (seq ...) for multiple bodies
...are variadic and can accept optional keyword parameters
Operators are just procedures that run at compile time, so they respond to the same messages as procedures. They can be used at runtime via the magic of apply, but their arguments must be quoted, and their output will be unevaluated unless piped into env.eval.