-*- fill-column:73; ais523autofill:t; -*-
, Pushes a list containing nothing but a pointer to the occurence of ,
that was called onto the stack.
. Pushes a list containing nothing but a pointer to the current TOS onto
the stack. (If the stack subsequently increases, the pointer continues
to point to the stack element that was TOS at the time that . was
called, unless the pointer is retargeted.)
z. Changes the stack so that whatever TOS points to (it must be a pointer
or a list containing nothing but a pointer) is in the new stack. The
top of the old stack is detached. (To clarify, this changes which list
is used as the stack.) Changing the stack also changes the variable
table, because the variable table's always immediately after the stack.
* Replaces the top two elements of the stack with a list containing all
of the elements of the list that was second on the stack (in the same
order), followed by all the elements of the list that was first on the
stack (in the same order). It is unspecified whether the list is as
quoting as the TOS was or as quoting as the second stack element was.
^ Appends a pointer to the next element that would be executed to the
TOS, detaches the TOS, and then unconditionally jumps to the first
element of the list that has just been detached. (If the TOS was a
pointer, it is converted to a list containing only that pointer). If
the next element that would be executed is itself a pointer, instead
of using a pointer to it a pointer to its destination is used.
~ Swaps the top two elements of the stack.
` Swaps the top two elements of the stack, then takes the same action as
^.
& Swaps the top two elements of the stack, then takes the same action as
,.
@ Swaps the second and third elements of the stack.
? TOS must be a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), or an error occurs. It is replaced by a copy of
whatever it points to. If it was pointing one-past-the-end, it is
instead replaced by an empty nonquoting list.
= TOS must be a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), or an error occurs. Whatever it points to is
replaced by a copy of the second element of the stack, and the top two
elements of the stack are detached. If it was pointing
one-past-the-end a copy of the second element is instead inserted at
the end of the list it was pointing into.
/ TOS must be a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), or an error occurs. A copy of the second element of
the stack is inserted just before the element it points to (at the end
of the list it points into if it was pointing one-past-the-end), and
the top two elements of the stack are detached.
\ TOS must be a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), or an error occurs. Whatever it points to is
detached, and TOS is also detached. (Detaching one-past-the-end has no
effect).
: Pushes a copy of TOS onto the stack.
! Detaches TOS from the stack (if nothing was pointing at it, this has
the effect of popping the stack).
z! Detaches TOS from the stack; if it's a quoting or nonquoting list, its
delimiters are removed in the process, leaving a nondelimited list not
connected to anything (as all nondelimited lists are). The delimiters
are left behind separately containing nothing if anything was pointing
to them.
_ Quotes the second stack element, prepends z to it, appends A to it,
appends it to TOS, and then does ^.
} Replaces TOS (interpreted as a number) with a list that represents the
number equal to the number TOS represents plus 1. The representation
used is unspecified.
{ Replaces TOS (interpreted as a number) with a list that represents the
number equal to the number TOS represents minus 1, or 0 if it
represented 0 before. The representation used is unspecified.
+ Interprets the top two elements of the stack as numbers, detaches
them, and replaces them with a list that represents the number equal
to the sum of the numbers they represent. The representation used is
unspecified.
- If the top element of the stack is a nonfrozen pointer or a list
containing nothing but a nonfrozen pointer, the second element must
also be a nonfrozen pointer. In this case, both are detached and
replaced with a number representing the number of consecutive D
commands that would transform the first pointer into the second, or
with a representation of zero if they have the same destination or no
number of D commands would transform the first into the second.
z- Otherwise, interprets the top two elements of the stack as numbers,
detaches them, and replaces them with a list that represents the
number equal to the difference of the numbers they represent if the
number the TOS represented was less than the number the second stack
element represented, or a representation of 0 otherwise. The
representation used is unspecified.
' Pushes a quoting list containing the element that would be the next
command to be executed onto the stack, then transfers execution
unconditionally to what would be the next-but-one command.
0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
Each of these pushes a quoting list representing that number onto the
stack. Except in the case of 0, the normalised representation is used
for each of these numbers (n-1 colons followed by n-1 asterisks). This
means that 1 will push an empty quoting list onto the stack, for
instance.
; Takes the number at TOS, adds it to ten times the number at the second
stack element, to a hundred times the number at the third stack
element, and so on until a pointer is found; all the numbers and the
pointer are detached from the stack and the sum is pushed in place of
them (this is a numeric wimpmode; .1234; does the same as ([#1234]).)
For the purposes of this command, a list whose first element is a
pointer is treated the same as a pointer.
A When TOS is a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), changes that pointer to one pointing to the first
element of the list it previously pointed to (or to one-past-the-end
of an empty list). If it was pointing one-past-the-end, an empty
nonquoting list is created where it was pointing and the pointer is
retarget to one-past-the-end of the new list. If it was pointing to a
pointer, the pointer is replaced with a quoting list containing
nothing but the pointed-to pointer and the pointer at TOS is
retargeted to point at the first element of that list (i.e. its
original target).
zA When TOS is not a nonfrozen pointer, it is interpreted as a list and
replaced with its first element.
a When TOS is a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), changes that pointer to the one pointing to the
list that contains its previous target. If no list contained its
previous target, a quoting list is created containing its previous
target and it is retargeted at that.
za When TOS is not a nonfrozen pointer, it is replaced with a quoting
list containing the old TOS as its only element.
C Pushes a list onto the stack that contains a pointer to every element
that hasn't been garbage-collected yet, isn't contained in any list
that has yet been mentioned, referenced, pointed-to, or referenced in
the program, and doesn't have a preceding element.
c Generates a continuation consisting of the current state of the
program (after the call to c), pushes it onto the stack, and then does
the same as the ^ command. If the continuation is called, it turns
back time to the time when c was called, and instead detaches the new
TOS and pushes a copy of the element that was TOS when the
continuation was called onto the stack. The continuation contains the
IP, stack, varaibles, and any lists used by the program, but not the
hashtable, command definitions, or IP movement definitions.
D When TOS is a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), changes that pointer to one pointing to the
element after the element it was pointing to. If it was pointing to
the last element in the list, it is retargeted to point
one-past-the-end, and if it was pointing one-past-the-end, an empty
nonquoting list is inserted before its current target and it remains
pointing one-past-the-end.
zD When TOS is not a nonfrozen pointer, it is interpreted as a list and
its first element is deleted.
d TOS must be a nonfrozen pointer (or a list containing nothing but a
nonfrozen pointer), or an error occurs. It is retargeted at the
element before the element it was pointing to, or one-past-the-end in
that list if it was pointing to the first element of the list.
e For each element of the list represented by the second stack element,
e pushes it onto the stack, runs the commands specified by the
original TOS, and then detaches and remembers the top element of the
resulting stack. Once all the elements have been processed a list
consisting of the remembered elements in the order they were processed
is pushed onto the stack. For instance, (abc)'ae is equivalent to
((a)(b)(c)) and (abc)':e is equivalent to (a)(b)(c)(abc).
f Interprets the second stack element as a number, replaces the TOS
(converting it to a list if it's a pointer) with a list whose elements
are repeated a number of times equal to the second stack element, and
does the same as ^ would do to the new list; so 3(abc)f has the same
effect as (abcabcabc)^ would.
g TOS must be an integer. It's detached and replaced with a
representation of 1 if it was 0, or with a representation of 0
otherwise.
H Run the perfect-hash function on TOS and replace it with the result.
h Replace TOS (which must be an integer) with the list with the
perfect-hash TOS.
i Inputs one character from standard output and pushes it onto the
stack. The character is represented with a nonquoting list. A
representation of 0 is pushed at EOF.
I Detaches the first element of the stack; if it was a representation of
0, swaps the new top two elements of the stack. The old TOS must be an
integer.
k Returns a function that takes one argument, ignores it, and returns
the TOS at the time k was called. The old TOS is detached.
l Inserts a pointer at the end of the list at TOS (converting it to a
list if it's a pointer) that points back to the start of that list,
then does the same as ^ would do to the new list.
L If the TOS is a nonfrozen pointer or a list containing nothing but a
nonfrozen pointer, replaces it with a list that is a representation of
zL the number of elements in the list it points to. Otherwise, treats it
as a list and replaces it with the number of elements in that list.
n Outputs a newline to standard output.
N Interprets the TOS as a number and replaces it with a list containing
a normalised version of that number (that is, n-1 asterisks followed
by n-1 colons for a TOS representing n). If TOS represents 0, it is
replaced by an unspecified representation of 0. Note that normalising
a non-normalised number can improve the efficiency of some
implementations.
o Interprets TOS as a character, outputs it to standard output, and
detaches it. If TOS is a representation of 0, the program ends without
an error message (so that cat-like programs don't need to check for
EOF, it's handled automatically; cat is (io)l, for instance.)
O Replaces TOS (interpreted as a number) with a list that represents the
number equal to the number TOS represents times 10. The representation
used is unspecified.
p Replaces TOS with a string which, if typed as part of an Overload
program, would represent that string. All lists that occur as elements
within TOS (or within its elements, their elements, and so on) that
represent normalised numbers are written in abbreviated notation,
either as a character if it's printable, not <>()[] or ", and the list
that contains it is nonquoting, as a quoted character if the list is
nonquoting and it is in the list of characters above (for instance,
<[#33]> would be converted to ""), and as a list containing a
hexadecimal number otherwise, except in the case of 1 (so <:*> is
converted to <[$2]> but <> is converted to <>). If any lists that
occur as elements (any level down) of TOS happen to be representations
of the number 0, it is unspecified what string they are replaced with,
except that it must be a valid representation of 0 and have the same
quoting status. If any identifiers have to be used to represent
pointers, all such identifiers will start with an underscore. If there
are pointers out from TOS to other destinations, they will be replaced
by an identifier not used elsewhere in the string generated by p
(except that multiple such pointers to the same destination will be
given the same identifier), and if there are pointers in to elements
of TOS from outside, it is unspecified whether a pointer destination
will be present in the string. (The IP and stack pointer do not count
for this purpose). No delimiters are provided around the resulting
string (so the program (ab)pS will output ab).
P Interprets TOS as a string (it must not contain any pointers as
elements or any elements which doesn't represent numbers); it parses
it and replaces it with a list that is represented by that string.
s Applies the curried substitution-application combinator (normally
called 's') to TOS, returning the result. The combinator is defined
so that 'a'b'cs^^ has the same meaning as 'ab'ac`.
S Interprets TOS as a string and outputs it to standard output. If it
contains any pointers, the targets of each of those are interpreted as
strings and output to standard output, and this can recurse through
any number of pointers. TOS is detached once the output is complete.
T TOS is detached and stored temporarily; the new TOS is interpreted as
a list, each of its elements is transformed to a 1-element quoting
list containing the transformed element (for instance, (abc) would
become ((a)(b)(c)), and each of its elements is moved to the stack so
that the first element ends up on top of the stack. Then the original
TOS is duplicated so that there are X-1 copies, where X is the number
of elements that the original second stack element had (0 if there
were 1 or 0 elements); a pointer to the next instruction is appended
to the set of copies (all of which run on to each other), and the
start of that detached list is unconditionally jumped to. For
instance, (abc)(*)T is the same as (c)(b)(a)(**)^ or (cba).
t This does the same as T, except that the elements aren't transformed
to quoting lists but kept as they are; so ((a)(b)(c))'*t is the same as
(c)(b)(a)(**)^ or (cba).
U Interprets TOS as a number; replaces it with a list consisting of all
integers from 1 to that number inclusive as elements, in order.
u Interprets TOS as a number; replaces it with a list consisting of all
integers from 0 to that number inclusive as elements, in order.
V Reads decimal digits from standard input as long as the input is a
decimal digit, and interprets the digits read as a decimal number,
pushing it onto the stack. The nondigit that stopped the read is left
on the stack. If the first character present isn't a digit, standard
input is left unchanged and a representation of 0 is pushed onto the
stack. Note that most interactive standard inputs will pause program
execution until a newline is typed when any input is attempted.
v Interprets TOS as a number, outputs it on standard output in decimal,
and detaches TOS. (No newlines or spaces are output after the
number).
w Prepends and appends code to TOS and then runs ^, in such a way that
the commands in TOS will keep repeating until TOS is 0 at the end of
one set of commands the original TOS represented (it must be numeric
at each of these points). If the original SE2 (new TOS) is 0 at the
start, the loop starts anyway. Once the loop finishes, the final TOS
(which will be 0) is detached.
W Does the same as w, except that TOS is detached after each time it's
checked (rather than right at the end of the loop).
x Reads the variable named TOS. (Variable names are
everything-sensitive, including quotingness; variables are global and
stored in a list immediately after the stack). TOS is detached and
replaced with a copy of the variable's value.
X Writes the variable named TOS with the second stack element (by copy);
detach the old top two stack elements.
z Modifies the next command executed, often by turning off any special
handling the command might have for pointers (this is known as
'freezing pointers'; many commands have special handling for
'nonfrozen pointers'). Many commands have separate documentation for
the z-modified versions, and there are others where the documentation
for the z-modified and unmodified versions are partially merged.
<$1c> Causes the program to change debug mode; the debug mode to change
to is taken from the top of the stack.