In the Thun dialect of Joy there are only four kinds of things:

- Integers (positive and negative, unbounded)
- Boolean values "true" and "false"
- Lists of things enclosed by square brackets ("[" and "]").
- Symbols (names) which denote functions.

When the interpreter encounters a literal value (an integer, Boolean, or list) it is put onto the stack:

In [ ]:

    1 2 3 true false [4 5 true []]

When symbols are encountered they are looked up in the dictionary and the function they denote is evaluated:

In [ ]:

    cons

There is a special function `trace` that will print a trace of the evalutation of an expression step-by-step. (It's like the `i` combinator with side-effects):

In [ ]:

    [cons] trace

Let's see some other functions.

In [ ]:

    [pop unit ccons]

In [ ]:

    trace

In [ ]:

    sum

In [ ]:

    clear

Control flow is achieved by special functions called combinators that accept quoted expressions on the stack and prefix them in various ways to the pending expression. The four core combinators are:

- `branch` - do one thing or another based on a condition.
- `loop` - do one thing over again (or not.)
- sequence - do one thing then another (not a combinator, this is the default operation.)
- `fork` (do things independently of each other, parallel.)

In [ ]:

    23

In [ ]:

    dup 0 < [] [0 swap -]

In [ ]:

    [branch] trace

In [ ]:

    neg

In [ ]:

    [dup 0 < [] [0 swap -] branch] trace