Whitespace is ignored, apart from the fact that it can be used to separate integers.
If the first element is an integer, we execute it's associated command, with the rest of the program/quoted program, unevaluated, as arguments.
If the first element is a quoted program, we execute it as a toplevel program, then use that as the command number (as above).
- (arity 1+) The first argument must be an integer, the rest anything. Execute the command numbered by the first argument with the arguments of the rest of the arguments evaluated. (Phew!)
- (arity 1) Return the argument, unscathed.
- (arity 2) Both arguments must be quoted programs. They are munged (concatentated) together.
- (arity 1) Munges the quoted program argument with itself.
- (arity 2) Both arguments must be integers. They are added together.
- (arity 2) Both arguments must be integers. They are subtracted. If a negative value results, they get added instead.
- (arity 0) A character is read from standard input and returned as its ASCII number.
- (arity 1) The argument must be an integer. It is printed out, as its ASCII character, to the screen. Then it is returned.
- (arity 3) The arguments may be anything. If the first argument is 0, the third argument is returned, otherwise the second is returned.
- (arity 1+) The first argument must be an integer. An integer is returned, which when called as a command, is like calling the first argument with the arguments of the rest of the arguments to this command plus the arguments passed to the returned command. (...Of course!)
Reads one character in, and prints it out.
How it works
0 is being called with 7 and (6), so it knows it has to run the command 7, but with what arguments? Well: 0 runs it with the rest of the arguments it gets, but evaluated, unlike a normal call. So: we run the program (6), which calls 6, which reads a character from input and returns it. Then we run 7 with that character, printing it out.