-eq? nn-f - - Compare two values for inequality. Returns `TRUE` if they are not equal or `FALSE` otherwise. class:primitive #1 #2 -eq?\n $a $b -eq? {n/a} global all
0; n-n || n- - - If `n` is zero, drop `n` and exit the current word. If non-zero, leave `n` alone and allow execution to continue. class:macro {n/a} {n/a} global all
FALSE -n - - Returns `0`, the value used to indicate a FALSE result. class:word {n/a} {n/a} global all
FREE -n - - Returns the number of cells available to your application. This is the amount of memory, less the already consumed portion and buffers mapped for RETRO's internal use. class:word {n/a} {n/a} global all
Heap -a - - Variable. Holds the address of the next available cell. class:data {n/a} {n/a} global all
RewriteUnderscores -a - - Variable. When set to `TRUE`, RETRO will replace underscores in strings with spaces. When `FALSE`, RETRO does not. class:data {n/a} {n/a} global all
STRINGS -a - - Return the address of the start of the temporary string pool. class:word {n/a} {n/a} global all
ScopeList -a - - Variable. This holds some information used by `{{` and `}}`. class:data {n/a} {n/a} global all
a:-eq? aa-f - - Compare all values in the array. Return `FALSE` if all values are equal or `TRUE` otherwise. This assumes the array contains only numeric values. class:word {n/a} {n/a} a all
a:counted-results q-a - - Run a quote and construct a new array from the returned values. The quote should return the values and the number of values to put into the array. class:word {n/a} {n/a} a all
a:dup a-b - - Make a copy of an array. Return the address of the copy. class:word {n/a} {n/a} a all
a:eq? aa-f - - Compare all values in the array. Return `TRUE` if all values are equal or `FALSE` otherwise. This assumes the array contains only numeric values. class:word {n/a} {n/a} a all
a:filter aq-b - - For each item in the initial array, run the specified quote. If the quote returns `TRUE`, copy the item into a new array. If `FALSE`, discard it. Returns a pointer to the new array. class:word {n/a} {n/a} a all
a:for-each aq- - - Execute the quote once for each item in the array. class:word {n/a} {n/a} a all
a:from-string s-a - - Create a new array with the characters in the source string. class:word {n/a} {n/a} a all
a:length a-n - - Return the length of a array. class:word {n/a} {n/a} a all
a:make q-a - - Execute quote. Return a new array containing the values the quote leaves on the stack. This is identical to doing `a:counted-results a:reverse` class:word {n/a} {n/a} a all
a:map aq-b - - Execute quote once for each item in the array. Constructs a new array from the value returned by the quote. class:word {n/a} {n/a} a all
a:middle afl-a - - Extract a new array from the middle of the specified array. This will take the values starting at `f` and extend to the `l` last value. class:word {n/a} {n/a} a all
a:reduce pnq-n - - Takes an array, a starting value, and a quote. This will apply the quote to each item in the array; the quote should consume two values and return one. class:word {n/a} {n/a} a all
a:reverse a-b - - Reverse the order of items in a array. This will return a new array. class:word {n/a} {n/a} a all
a:to-string a-s - - Create a new string from the provided array. This string will be stored in the temporal string buffers. class:word {n/a} {n/a} a all
call a- - - Call a function. class:primitive {n/a} {n/a} global all
case nmq- || nmq-n - - If `n` is equal to `m`, drop both and execute the specified quote before exiting the calling word. If not equal, leave `n` on the stack and let execution continue. class:word {n/a} {n/a} global all
choose fqq- - - Execute q1 if the flag is true (-1) or q2 if the flag is false (0). Only these flags are valid when using `choose`. class:word {n/a} {n/a} global all
class:data n- || n-n - - Class handler for data structures. Keep the address or value on the stack. Compile the value or address as a literal into the current definition. class:word {n/a} {n/a} class all
class:macro a- - - Class handler for compiler macros (immediate words) Execute the function at the provided address. Execute the function at the provided address. class:word {n/a} {n/a} class all
class:primitive a- - - Class handler for primitive words (words which map to Nga instructions) Execute the function. Compile the machine code in the definiton into the current definition. class:word {n/a} {n/a} class all
class:word a- - - Class handler for normal words. Execute the function at the provided address. Compile a call to the specified address into the current definition. class:word {n/a} {n/a} class all
d:add-header saa- - - Create a header. Provide a string (s) for the name, a pointer to the class handler (a1) and a pointer to the word definition (a2) Generally this won't be used directly. class:word {n/a} {n/a} d all
d:class d-a - - Given a dictionary header, return the class field. class:word {n/a} {n/a} d all
d:create s- - - Create a new dictionary header named the specified string. The new header will point to `here` and have a class of `class:data`. class:word {n/a} {n/a} d all
d:for-each q- - - Execute the specified quote once for each header in the dictionary. Before running the quote, this also pushes a pointer to the header onto the stack. class:word {n/a} {n/a} d all
d:last -d - - Return the most recent dictionary header. class:word {n/a} {n/a} d all
d:last<class> -a - - Return a pointer to the class field of the most recent dictionary header. class:word {n/a} {n/a} d all
d:last<name> -s - - Return a pointer to the name field of the most recent dictionary header. class:word {n/a} {n/a} d all
d:last<xt> -a - - Return a pointer to the xt field of the most recent dictionary header. class:word {n/a} {n/a} d all
d:link d-a - - Given a dictionary header, return the link field. class:word {n/a} {n/a} d all
d:lookup s-d - - Lookup the specified name in the dictionary and return a pointer to its dictionary header. This returns zero if the word is not found. class:word {n/a} {n/a} d all
d:lookup-xt a-d - - Lookup the specified address in the dictionary and return a pointer to its dictionary header. This returns zero if the word is not found. class:word {n/a} {n/a} d all
d:name d-s - - Given a dictionary header, return the name field. class:word {n/a} {n/a} d all
d:words-beginning-with s- - - Display a list of all named items in the `Dictionary` that begin with the provided substring. class:word {n/a} {n/a} d rre
data - - - Change the class of the most recently defined word to `class:data`. class:word {n/a} {n/a} global all
depth -n - - Return the number of items on the stack. class:word {n/a} {n/a} global all
dip nq-n - - Temporarily remove n from the stack, execute the quotation, and then restore n to the stack. class:word {n/a} {n/a} global all
does q- - - Attach an action to the most recently created word. This is used in a manner similar to CREATE/DOES> in traditional Forth. class:word {n/a} {n/a} global all
drop n- - - Discard the top value on the stack. class:primitive {n/a} {n/a} global all
drop-pair nn- - - Remove top two items on the stack. class:word {n/a} {n/a} global all
dump-stack - - - Display the items on the data stack. class:word {n/a} {n/a} global all
dup n-nn - - Duplicate the top item on the stack. class:primitive {n/a} {n/a} global all
dup-pair nm-nmnm - - Duplicate the top two items on the stack. class:word {n/a} {n/a} global all
eq? nn-f - - Compare two values for equality. Returns `TRUE` if they are equal or `FALSE` otherwise. class:primitive #1 #2 eq?\n $a $b eq? {n/a} global all
f:-eq? -f - FF- Compare two floating point values for inequality. Returns `TRUE` if they are not equal or `FALSE` otherwise. class:word {n/a} {n/a} f rre
f:between? -f - nlu- Return TRUE if number is between the lower (l) and upper (u) bounds. If not, return FALSE. This is inclusive of the limits. class:word .3 .1 .100 f:between?\n .100 .200 .300 f:between? {n/a} f rre
f:case q- - nm-n If `n` is equal to `m`, drop both and execute the specified quote before exiting the calling word. If not equal, leave `n` on the stack and let execution continue. class:word {n/a} {n/a} f rre
f:limit - - nlu-m Return n if it is within the lower (l) and upper (u) bounds. If outside the bounds, return the closes boundary value. class:word .-10 .5 .8 f:limit\n .10 .1 .15 f:limit {n/a} f rre
file:open sm-h - - Open a named file (s) with the given mode (m). Returns a handle identifying the file. class:word '/etc/motd file:R file:open {n/a} file rre
file:spew ss- - - Given a string (s1) and a file name (s2), write the string into the file, replacing any existing cotent. class:word {n/a} {n/a} file rre
gopher:get asns-n - - Takes an address, a server, a port, and a selector. Fetch the resource and store it at address. Return the number of bytes received. class:word here 'forthworks.com #70 '/ gopher:get\n here s:put {n/a} gopher ios
hook - - - Add a hook point into the current word. This should only be used as the first word in a definition. class:macro :foo hook ; {n/a} global global
io:invoke n- - - Invoke an interaction with an I/O device. class:word {n/a} {n/a} io all
io:query n-mN - - Ask an I/O device to identify itself. Returns a version (m) and device ID (N). class:word {n/a} {n/a} io all
io:scan-for n-m - - Scan the I/O devices for a device with a specified ID. Returns the device number, or -1 if not found. class:word {n/a} {n/a} io all
n:abs n-n - - Return the absolute value of a number. class:word #10 n:abs\n #-10 n:abs\n {n/a} n all
n:between? nlu-f - - Return TRUE if number is between the lower (l) and upper (u) bounds. If not, return FALSE. This is inclusive of the limits. class:word #3 #1 #100 n:between?\n $q $a $b n:between? {n/a} n all
n:dec n-m - - Decrement n by one. class:word #100 n:dec {n/a} n all
n:even? n-f - - Return `TRUE` if number is even, or `FALSE` if not. class:word #12 n:even?\n #11 n:even? {n/a} n all
n:inc n-m - - Increment n by one. class:word #100 n:inc {n/a} n all
n:limit nlu-m - - Return n if it is within the lower (l) and upper (u) bounds. If outside the bounds, return the closes boundary value. class:word #-10 #5 #8 n:limit\n #10 #1 #15 n:limit {n/a} n all
n:max mn-o - - Return the greater of two values. class:word #1 #7 n:max\n #-8 #-10 n:max {n/a} n all
n:min mn-o - - Return the lesser of two values. class:word #1 #7 n:min\n #-8 #-10 n:min {n/a} n all
parse-until q-s - - Read input from stdin (via `c:get`) until the returned character is matched by the quote. Returns a string. class:word :read-until-period (-s)\n [ $. eq? ] parse-until ; {n/a} all rre
prefix:! ns- - - Store a value into a variable. Store a value into the named variable. Compile the code to store a value into a named variable. class:macro {n/a} {n/a} prefix all
prefix:" s-s - - Process token as a string. Keep string as permanent. If `RewriteUnderscores` is `TRUE`, replace all instances of _ with space. Keep string as permanent. If `RewriteUnderscores` is `TRUE`, replace all instances of _ with space. Then compile the string into the current definition. class:macro {n/a} {n/a} prefix all
prefix:# s-n - - Process token as a number. Convert the string into a number and leave on the stack. Convert the string into a number and compile into the current definition as a literal. class:macro {n/a} {n/a} prefix all
prefix:$ s-c - - Process token as an ASCII character. Fetch first character from string. Leave on stack. Fetch first character from the string. Compile into the current definition as literal. class:macro {n/a} {n/a} prefix all
prefix:& s-a - - Return a pointer to a named item. Lookup name in dictionary, return contents of the xt field on the stack. Lookup name in dictionary, compile code to push the contents of the xt field into the current definition. class:macro {n/a} {n/a} prefix all
prefix:' s-s - - Process token as a string. Move string into temporary buffer. If `RewriteUnderscores` is `TRUE`, replace all instances of _ with space. Move string into temporary buffer. If `RewriteUnderscores` is `TRUE`, replace all instances of _ with space. Then compile the string into the current definition. class:macro {n/a} {n/a} prefix all
prefix:( s- - - Process token as a comment. Discard the string. Discard the string. class:macro {n/a} {n/a} prefix all
prefix:. s- - -F Interpret time: convert string to a floating point value. Compile time: convert string to a floating point value and compile code to push this value to the float stack. class:macro {n/a} {n/a} prefix rre
prefix:: s- - - Process token as a new definition. Create a header pointing to `here` with the provided string as the name. Sets class to `class:word`. class:macro {n/a} {n/a} prefix all
prefix:@ s-n - - Fetch from a stored variable. Fetch a value from a named variable. Compile the code to fetch a value from a named variable into the current definition. class:macro {n/a} {n/a} prefix all
prefix:` s- - - Process token as a bytecode. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} prefix all
prefix:| s- - - POSTPONE equivalent. Discard the string. Convert the string to a number and use `,` to inline it into the current definition. class:macro {n/a} {n/a} prefix all
random:mersenne -n - - Return a random number using a mersenne shifter class:word {n/a} {n/a} random rre
random:mersenne:set-seed n- - - Seed random:mersenne with the specified value class:word {n/a} {n/a} random rre
random:xoroshiro128** -n - - Return a random number using xoroshiro128** class:word {n/a} {n/a} random rre
random:xoroshiro128**:jump - - - Updates the internal xoroshiro128** state registers with the equivalent of 2^64 calls to random:xoroshiro128**. class:word {n/a} {n/a} random rre
random:xoroshiro128**:set-seed n- - - Seed random:xoroshiro128** with the specified value class:word {n/a} {n/a} random rre
random:xoroshiro128**:test-seed nnnn- - - Sets the internal xoroshiro128** state registers s0..s3 starting with TOS. class:word {n/a} {n/a} random rre
reclass a- - - Change the class handler of the most recently defined word to the specified one. class:word {n/a} {n/a} global all
reorder ...ss-? - - Restructure the order of items on the stack. class:word {n/a} {n/a} global all
repeat - - - Begin an unconditional loop. class:macro {n/a} {n/a} global all
reset ...- - - Remove all items from the stack. class:word {n/a} {n/a} global all
rot abc-bca - - Rotate the top three values. class:word {n/a} {n/a} global all
s, s- - - Compile the code needed to push a string pointer to the stack and inline the string data into the current definition. class:word {n/a} {n/a} global all
s:case sSq- || sSq-s - - If the `s` matches `S`, discard `s` and run the quote before exiting the caller. If they do not match, discard the quote and leave `s` on the stack. class:word {n/a} {n/a} s all
s:const ss- - - Create a constant named s2, returning a pointer to s1. This will use `s:keep` to preserve the original string. class:word {n/a} {n/a} s all
s:contains-char? sc-f - - Return `TRUE` if the character is present in the string or `FALSE` otherwise. class:word {n/a} {n/a} s all
s:contains-string? ss-f - - Return `TRUE` if the second string is present in the first string or `FALSE` otherwise. class:word {n/a} {n/a} s all
s:copy sa- - - Copy a string (s) to a destination (a). This will include the terminator character when copying. class:word {n/a} {n/a} s all
s:empty -s - - Return an empty string. class:word {n/a} {n/a} s all
s:eq? ss-f - - Compare two strings for equality. Return `TRUE` if identical or `FALSE` if not. class:word 'hello 'again s:eq?\n 'test 'test s:eq? {n/a} s all
s:filter sq-s - - Execute the quote once for each value in the string. If the quote returns `TRUE`, append the value into a new string. If `FALSE` the value will be discarded. class:word {n/a} {n/a} s all
s:index-of-string ss-n - - Return the location of the first instance of the specified substring (s2) in the string (s1). Returns -1 if not found. class:word {n/a} {n/a} s all
s:keep s-s - - Store a string into the heap and return a pointer to the start of it. class:word {n/a} {n/a} s all
s:left sn-s - - Return a new string containing the first `n` characters from the source string. class:word {n/a} {n/a} s all
s:length s-n - - Return the number of characters in a string, excluding the NULL terminator. class:word {n/a} {n/a} s all
s:map sq-s - - Execute the specified quote once for each character in the string. Builds a new string from the return value of the quote. The quote should return only one value. class:word {n/a} {n/a} s all
s:prepend ss-s - - Return a new string consisting of s2 followed by s1. class:word {n/a} {n/a} s all
s:split-on-string ss-ss - - Split a string on the first occurrance of the specified string. After the split, the top stack item will be the part of the string before the specified subsring, and the second item will be the rest of the original string. class:word 'Hello_Brave_World! 'Brave s:split-on-string s:put nl s:put nl {n/a} s all
s:substr sfl-s - - Extract a substring from the specified string. This will take the characters starting at `f` and extend `l` characters in length. class:word {n/a} {n/a} s all
s:temp s-s - - Move a string into the temporary string buffers. class:word {n/a} {n/a} s all
s:to-float s- - -F Convert a string representation into a floating point value. class:word {n/a} {n/a} s rre
s:to-lower s-s - - Convert uppercase ASCII characters in a string to lowercase. class:word {n/a} {n/a} s all
s:to-number s-n - - Convert a string to a number. class:word {n/a} {n/a} s all
s:to-upper s-s - - Convert lowercase ASCII characters in a string to uppercase. class:word {n/a} {n/a} s all
s:tokenize sc-a - - Takes a string and a character to use as a separator. It splits the string into substrings and returns an array containing pointers to each of them. class:word {n/a} {n/a} s all
s:tokenize-on-string ss-a - - Takes a string (s1) and a substring (s2) use as a separator. It splits the string into substrings and returns as array containing pointers to each of them. class:word {n/a} {n/a} s all
shift mn-o - - Peform a bitwise shift of m by n bits. If n is positive, shift right. If negative, the shift will be to the left. class:primitive {n/a} {n/a} global all
sip nq-n - - Run quote. After execution completes, put a copy of n back on top of the stack. class:word {n/a} {n/a} global all
socket:accept n-nn - - Begin accepting connections. Returns a new socket and an error code. class:word {n/a} {n/a} socket rre
socket:bind sn-n - - Bind a socket to a port. The port should be a string. Returns 0 if successful or -1 othewise. class:word {n/a} {n/a} socket rre
socket:close n- - - Close a socket. class:word {n/a} {n/a} socket rre
socket:configure ss- - - Configure internal settings for a host (s1) and port (s2). Use before `socket:bind`. class:word {n/a} {n/a} socket rre
socket:connect n-nn - - Connect to a server. Provide a socket, this will return a status flag and an error code. class:word {n/a} {n/a} socket rre
socket:create -n - - Obtain a new socket. class:word {n/a} {n/a} socket rre
socket:gethostbyname as- - - Get the host IP in dotted notation. The host is specified by the string and the address is the start of the buffer for the dotted IP. class:word {n/a} {n/a} socket rre
socket:listen nn-nn - - Prepare a socket for accepting incoming quotations. Takes a backlog count (n1) and a socket (n2). Returns a flag (0 success, -1 failed) and an error code. class:word {n/a} {n/a} socket rre
socket:recv ann-nn - - Receive data from a socket. This will read into memory starting at address *a*, up to *n1* bytes. *n2* is the socket. Returns the number of bytes read and an error code. class:word {n/a} {n/a} socket rre
socket:send sn-nn - - Send a string to a socket. This will return the number of characters sent and an error code. class:word {n/a} {n/a} socket rre
unhook a- - - Reset the hook point in a1 to the default definition. class:word :foo hook #1 ;\n :bar #2 ;\n &bar &foo set-hook\n &foo unhook {n/a} global all
unix:for-each-file q- - - Run a quote once for each file or subdirectory in the current directory. The quote will receive the file name as a string and should consume this and return nothing on the stack. class:word {n/a} {n/a} unix rre
unix:getenv sa- - - Get an environment variable. Provide the name and an address to store it in. class:word 'SHELL s:empty [ unix:getenv ] sip s:put nl {n/a} unix rre
unix:io:n:put n- - - Display a number (in base 10) to the standard output device. This is faster than `n:put`, but not portable. class:word {n/a} {n/a} unix:io rre
unix:io:s:put s- - - Display a string to stdout. This is faster than `s:put`, but not portable. class:word {n/a} {n/a} unix:io rre
unix:kill nn- - - Terminates a process. Takes a process and a signal to send. class:word {n/a} {n/a} unix rre
unix:pclose n- - - Close a pipe. class:word {n/a} {n/a} unix rre
unix:popen sn-n - - Open a pipe. Takes a command to run, and a file mode (`file:R` or `file:W`; `file:R+` may work on some systems). Returns a file ID usable with words in the `file:` namespace. class:word {n/a} {n/a} unix rre
unix:putenv s- - - Takes a string in the form `name=value` and sets an environment variable named `name` to `value`. class:word 'EDITOR=vi unix:putenv {n/a} unix rre
unix:system s- - - Runs another application using the system shell and returns after execution is completed. class:word 'ls_-lh_/etc unix:system {n/a} unix rre
until q- - - Execute quote repeatedly while the quote returns a value of `FALSE`. The quote should return a flag of either `TRUE` or `FALSE`, though `until` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:zero? ] until {n/a} global all
v:dec a- - - Decrement the value stored at the specified address by 1. class:word {n/a} {n/a} v all
v:dec-by na- - - Decrement the value stored at the specified address by the specified value. class:word {n/a} {n/a} v all
v:inc a- - - Increment the value stored at the specified address by 1. class:word {n/a} {n/a} v all
v:inc-by na- - - Increment the value stored at the specified address by the specified value. class:word {n/a} {n/a} v all
v:limit alu- - - Fetch the value stored at the address, then run `n:limit` against it, using the specified lower and upper bounds. Then store the resulting value back to the original address. class:word {n/a} {n/a} v all
v:off a- - - Set a variable to 0. class:word {n/a} {n/a} v all
v:on a- - - Set a variable to -1. class:word {n/a} {n/a} v all
v:preserve aq- - - Make a copy of the value at the address, then run the quote. Once the quote completes, restore the address to the specified value. class:word {n/a} {n/a} v all
v:update aq- - - Fetch a value from the specified address, then run the quotation with this value on the stack. Afterwards, store the returned value at the original address. class:word {n/a} {n/a} v all
while q- - - Execute quote repeatedly while the quote returns a `TRUE` value. The quote should return a flag of either `TRUE` or `FALSE`, though `while` will treat any non-zero value as `TRUE`. class:word #10 [ dup n:put nl n:dec dup n:-zero? ] while {n/a} global all
{ - - - Begin an array. This is intended to make creating arrays a bit cleaner than using a quotation and `a:counted-results`. class:word {n/a} {n/a} global all
}} - - - End a lexically scoped area. This will hide any headers between `{{` and `---reveal---`, leaving only headers between `---reveal---` and the `}}` visible. class:word {n/a} {n/a} global all