Skip to content

evaluation

pannous edited this page Oct 26, 2020 · 17 revisions

Objects are generally kept in their symbolic form until their lazy evaluation can no longer be delayed.

In root contexts objects get fully evaluated. Root contexts are the shell, files and the main function.

z=y*y
y=x+x
x=3

In the shell objects are printed in their symbolic form and evaluated until their final value is revealed:

>>> z
y*y
(x+x)*(x+x)
(3+3)*(3+3)
6*6
36

To see the final value of o=z directly, objects are evaluated with o() o? or o! The shell also has a direct mode in which the intermediate steps are omitted and just the final value is printed. Which way is default can be configured.

Objects being charged means that data is treated as code, and that their symbol gets evaluated.

help={info:"there is no help "}
> help # nothing happens, help is **uncharged data**
to help={print "there is no help "}
> help # prints the message, help was code
help={info:{get help}}
help # in root contexts like the shell help gets evaluated and ``get help`` is called
info:{get help}
info:"whatever get help returned"

Objects get charged with function keywords like to as can be seen above.
To uncharge symbols/functions they can be prefixed with function,code or data.
E.g. print function help will print the function definition, and not call get help.

When calling a function all parameters are fully evaluated (unless being explicitly uncharged as above)

It is important to note that help={data:{get help}} will not call get help until help is evaluated.
To create data with return values of evaluated functions on the spot, objects are evaluated with o() o? or o! help={info:{get help!}} help={info:"whatever get help returned"}

The exclamation operator '!' evaluates everything in an expression on its left side (on the spot).

Later: As in lisp there can be several levels of quoting. macros are just second order functions of auto-quoted data. To force arguments as being auto quoted, they can be denoted as data = quoted or code = block . To do: are these really equal synonyms, or does the block keyword act differently to the code class?

If in doubt, objects can be evaluated on the spot (in the current context) with o() o? or o!

The lisp concepts of quoted code as data closely resemble Angle's concept of uncharged symbols aka data. Unlike lisp in Angle charging and unchanging (un-quoting and quoting) are equal parts of the language.

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally