Joy is a stack-based functional language developed in the 2000's by Manfred von Thun. Everything is a function. Functions take a stack as their sole argument and produce an updated stack as their sole result.

Most functions operate only on the top three or so elements of the stack and will raise an error if the stack is not in a state on which the function can operate.

Proper Joy has many types, like numbers, booleans, and strings, but this particular implementation only supports lists and functions. Strictly speaking, even numbers and lists are functions that put themselves on the stack.

Type a function name and press Enter to evaluate it. Multiple functions, separated by a space, represent a composition.

Function evaluation can be delayed by wrapping the function (or a composition) in a pair of square brackets ([]'s). Such a wrapped sequence of zero or more functions is called a quotation (or list).

Here are some functions:

`i` evaluates a quotation:

[A] i == A

`dip` evaluates a quotation as if it was below the top:

[A] [B] dip == B [A]

`cat` concatenates two quotations:

[A] [B] cat == [A B]

`cons` prepends an item to a quotation:

[A] [B] cons == [[A] B]

`dup` duplicates the preceding item:

[A] dup == [A] [A]

`zap` removes the preceding item:

[A] zap ==

`swap` swaps the two preceding items:

[A] [B] swap == [B] [A]

`unit` quotes the preceding item:

[A] unit == [[A]]