-
-
Notifications
You must be signed in to change notification settings - Fork 4
code
block, code and closure are very similar concepts:
- every data with the intention of being evaluated is a block
- every block with concrete binding is code
- every code with a local-only binding is a closure
Code is Data that is charged.
Charging depends on assignment:
f : now
# uncharged data, evaluated only when f()
or f!
occurs, or via full evaluation with !!
f := now
# semi charged := evaluated upon normal evaluation of the parent context
def f:{now()}
# charged code, evaluated upon partial evaluation of the parent context
f = now
# charged symbol/variable: evaluated to the time whenever the symbol f occurs
f = now
# resolved to current time immediately in the REPL, or whenever f!
occurs
See evaluation for details.
While code can visually appear in different forms, under the hood these are identical after parsing
square := it * it
square a number := number times number
to square a number {
return number times number
}
(def square (number x) (times x x)) // lispy notation
Expressions can be grouped as normal lists, however curly braces {}
are the preferred enclosure.