Thyrd Opcodes

v0.3


Opcode Caption In Out Tags Help SideFX
select A wave Select A as the current stack none
add a b a+b arithmetic strings Pop two numbers and push their sum, or concatenate two strings none
and a b a&b logic Pop two booleans and push true if they're both true, false otherwise none
cell is atomic? c c bool thyrdspace Peeks at the top cell and pushs true if the cell is atomic (not a grid) none
select B wave Select B as the current stack none
bind aby thyrdspace Pop cells off the A, B, and Y stacks and bind them in a triad Error if three cells aren't present
break flow Pause the wave at this cell, allowing the user to inspect it, add code, etc. Pauses wave
call path combinator Pop the path on the top of the stack, go to that cell and evaluate it none
container cell else cell thyrdspace Pop off a cell and an else clause, and push the container cell of the given cell. If the cell doesn't have a container, evaluate the else clause. Error if two cells aren't present. Else clause can have side effects.
copy cells cell i0 j0 i1 j1 cell thyrdspace Given a cell and starting and ending coordinates, copy the range of cells into a new holding cell.
cut cells cell i0 j0 i1 j1 cell thyrdspace Given a cell and starting and ending coordinates, cut the range of cells into a new holding cell.
delete columns cell i0 i1 cell thyrdspace Given a cell and starting and ending i indexes, delete that range of columns
delete rows cell j0 j1 cell thyrdspace Given a cell and starting and ending j indexes, delete that range of rows
divide a b a/b arithmetic strings Pop two numbers and push their ratio, or subtract all instances of b from a none
drop x wave Remove the item on the top of the current stack none
duplicate a a a wave Duplicate the top of the stack none
dup cell cell cell dup thyrdspace Given a cell, push a new cell with the same contents
end a flow End wave, pop the current stack and store it in the result cell Terminates wave, sets result
equal a b a=b logic Pop two values and return true if they are the same none
error flow Stop the wave, displaying top of current stack as an error message Terminates wave
evaluate a combinator Pop the cell on the top of the stack and evaluate its contents none
filter a t b combinator Pop a grid (a) and a test (t). Evaluate the test against each of the cells in a and return grid b, which contains only those cells for which the test evaluates to true. Depends on program provided as input
find aby g thyrdspace Pop paths off the A, B, and Y stacks and search for all the triads that match, returning a grid of triads Error if three cells aren't present
fold a p p folded into a combinator Pop a grid (a) and a program (p). Evaluate the program with the first two cells of a, then with the result and the next cell from a, until the end of a. The final result is pushed on the stack. Depends on program provided as input
follow path path1 path2 else cell thyrdspace Pop off a two parts of a path and an else clause, and follow path2 starting from path1, pushing the resulting cell. If the path doesn't resolve, we evaluate the else clause. Error if three cells aren't present. Else clause can have side effects.
greater than a b a>b logic Pop two values, compare them, and push true if a is greater than b none
greater or equal a b a>=b logic Pop two values, compare them, and push true if a is greater than or equal to b none
get subcell cell i j cell thyrdspace Given a cell and i and j indexes, retrieve the subcell or make it if it doesn't exist yet Makes input cell a grid if necessary. Generates error if it can't make the subcell.
get type cell cell type thyrdspace Peek at the top cell and push it's type
has subcell? cell i j cell i j bool thyrdspace Peek a cell and i and j indexes, push true if the cell exists
if then else a (ifTrue) (ifFalse) combinator If a is true evaluate (ifTrue), else (ifFalse) depends on quoted code
index cell i j thyrdspace Pop off a cell and push its i and j indexes None
insert columns cell i n thyrdspace Given a cell and i index, add n columns after the indexed column
insert rows cell j n thyrdspace Given a cell and j index, insert n rows after row j
is under? grid cell grid cell bool thyrdspace Peek a grid cell and a cell, push true if the cell is anywhere under the grid
less than a b a logic Pop two values, compare them, and push true if a is less than b none
less or eqaul a b a<=b logic Pop two values, compare them, and push true if a is less than or equal to b none
make grid cell i0 j0 i1 j1 cell thyrdspace Given a cell and starting and ending coordinates, replace the cell at the starting coordinates with a grid containing the range of cells
map a p map p on a combinator Pop a grid (a) and a program (p). Evaluate the program with each of the cells of a and return grid b, which contains the results of the evaluations. Depends on program provided as input
map2 a b p p applied to the cells in a and b combinator Pop two grids (a and b) and a program (p). Evaluate the program with each of the cells of a and b and return grid c, which contains the results of the evaluations. The shape of c will be the same as a, the cells from b will be reused if necessary. Depends on program provided as input
merge grid glue cell strings Pop off a grid cell and a glue string. Treating the contents of the grid as a list, construct a string with each value in the list joined by the glue string and push that string. The glue string does not appear at the end. Error if two cells aren't present. If grid cell is atomic we just push it.
mergegrid grid iglue jglue cell strings Pop off a grid cell and two glue strings. Construct a string with each value in the grid joined by the i glue string along the i axis and the j glue string along the j axis, and push that string. The i glue string does not appear at the end of each row but the j glue string does appear at the end of the whole grid. Error if three cells aren't present. If the grid cell is atomic we just push it.
modulo a b a%b arithmetic strings Pop two numbers and push the remainder when a is divided by b. If the values are strings, return the tail of a following the rightmost appearance of b. none
move to A x wave Pop the current stack and push it on stack A Modifies stack A, unless A is already the current stack
move to B x wave Pop the current stack and push it on stack B Modifies stack B, unless B is already the current stack
move to X x wave Pop the current stack and push it on stack X Modifies stack X, unless X is already the current stack
move to Y x wave Pop the current stack and push it on stack Y Modifies stack Y, unless Y is already the current stack
multiply a b a*b arithmetic Pop two numbers and push their product Halts wave if not two numbers
nip from stack n wave Drop the nth item down in the stack
do nothing flow Do nothing none
not a !a logic Pop a truth value and return its negation none
not equal a b a!=b logic Pop two values, compare them, and push true they are not the same. none
null? a a bool logic Peeks at the top value and pushs true if the value is the empty string or 0 none
or a b a|b logic Pop two truth values, compare them, and push true if a or b is true. none
parse string glue grid strings Pop off a string and a glue string. Parse the string by spliting it into substrings as delineated by the glue string, and construct a grid containing a list of cells, one fore each substring. Error if two cells aren't present. If string cell is not atomic we just push it.
parsegrid string iglue jglue grid strings Pop off a string and two glue strings. Split the string into rows using the jglue and columns using iglue. The i glue string does not appear at the end of each row but the j glue string does appear at the end of the whole grid. The result is a grid cell with each cell containing one parsed element from the string. Error if three cells aren't present. If the string cell is not atomic we just push it.
paste cells hcell cell i0 j0 thyrdspace Given a holding cell, destination cell and starting coordinates, paste the cells from the holding cell to the destination.
pick from stack n cell wave Pick the nth item down in the stack and copy it to the top.
predecessor a a-1 arithmetic Pop a value and return the previous value. none
range set type cell i0 j0 i1 j1 type thyrdspace Given a range of cells (grid cell and starting and ending coordinates), and a type, change the type of the selected cells
recurse whennull prog recursion with prog combinator Pop a whennull value and a program. Recursively apply the program to the value below the ifnull, taking the pred each time and using whennull when the operand is null. Depends on program provided as input
recurselinear if then else1 else2 linear recursion combinator Pop four programs: if then else1 else2. If if evaluates true, eval then, else eval else1, recurse, and eval else2. Depends on program provided as input
repeat p n combinator Pop a cell p and a value n and evaluate p n times Depends on contents of p
reverse n wave Reverse the order of the stack, from 0 (top) to n
rotate n wave Rotate the order of the stack, so that item n is at the top
select a test success combinator Pop a grid (a) and a program (test). Evaluate the test against each of the cells of the grid, stopping when the test returns a true value. The result of the last evaluation of test is returned, which will be false if it failed for all the cells of a. Depends on program provided as input
sequence start end inc cell thyrdspace Given start, end, and increment values specifying a sequence, generate a new grid cell containing a list of cells representing the sequence
set cell value thyrdspace Pop off a cell and a value, and set the cell to the new value. Error if two cells aren't present.
set type cell type cell thyrdspace Given a cell and a type, change the type of the cell and leave it on the stack.
step a p p applied to each cell in a combinator Pop a grid (a) and a program (p). Evaluate the program with the first cell of a (along with whatever else was on the stack), then with the result and the next cell from a, until the end of a. The final result is pushed on the stack. Depends on program provided as input
subtract a b a-b arithmetic strings Pop two numbers and push their difference, or subtract one string from the other none
successor a a+1 arithmetic Pop a value and return the next value. none
swap a b b a wave Swap the order of the top two items on the stack none
switch plist success combinator Pop a grid containing a list of programs (plist). Evaluate each of the programs in turn, each should leave a return value that's popped off the stack. Stop evaluating programs from the list as soon as one returns a true value. Return the result of the last program evaluated (which will be false if they all failed). Depends on programs provided as input
execute tcl script result strings Pop a Tcl script and execute it, pushing the result Anything
to cell path cell thyrdspace Pop off a cell containing a path and push the corresponding cell. The path cell is used as the current cell for resolving a relative path. An error is generated if we can't make or resolve to a cell. Possible error.
to path cell path thyrdspace Pop off a cell and push a cell containing its path None
tuck n wave Pop n, then copy the top of the stack and insert it below the nth item in the stack.
unbind t thyrdspace Pop a cell containing a triad off the current stack and destroy the triad. Error if cell popped isn't a triad
wave's 'anchor' cell anchor wave Push the anchor cell for this wave. If there's no anchor cell specified we make one that will be destroyed when the wave destructs.
wave's 'next' route next wave Push this wave's next route (the route used to get from one cell to the next when flowing). None. Unless you mess with the route, in which case: good luck to you!
wave's 'previous' route prev wave Push this wave's previous route (the route used to get from one cell to the next when running in reverse). None. Unless you mess with the route, in which case: good luck to you!
select X wave Select X as the current stack none
select Y wave Select Y as the current stack none

Generated on June 19, 2010