Skip to contents

Functions to inspect and save installed froth words.

Usage

froth.dictionary()
writeFrothDictionary(file="", ...)

Arguments

file

file to write to, or "" for the console

...

additional arguments passed to cat

Details

froth.dictionary will list all installed words, grouped by their type (built-in, alias, user-defined).

writeFrothDictionary allows users to export their function definitions. The default argument will print out user-defined definitions to the console. This output can be redirected to a file by changing the file argument.

Value

None. froth.dictionary lists all installed words using message, and writeFrothDictionary either prints to the console or to a file.

Author

Aidan Lakshman ahl27@pitt.edu

Examples

## Show all words
froth.dictionary()
#> Built-in Words:
#> exit inspect words apply multiapply : forget lit
#> ( noop abort" reset ' execute clear swap
#> 2swap dup 2dup dig over 2over 2drop rot
#> drop ?dup >r r> r@ . .r emit
#> ." spaces space cr u.r + sum -
#> * div idiv ^ mod /mod 1+ 1-
#> 2+ 2- 2* 2/ negate abs min max
#> sqrt */ */mod invert or and xor 0=
#> 0< 0> < <= > >= = <>
#> if else do begin loop +loop while leave
#> until repeat i j k loopcounter loopend variable
#> ! @ length length? +! ? constant cells
#> allot extend reallot fill erase create , r_rnorm
#> 
#> Aliases:
#> quit (exit) compile (:) ) (noop) .s (inspect)
#> xx (reset) \ (noop) ['] (') % (mod)
#> / (div) %/% (idiv) pow (^) times (*)
#> ++ (1+) -- (1-) neg (negate) not (invert)
#> ~ (invert) & (and) | (or) equal (=)
#> eq (=) != (<>) neq (<>) gr (<)
#> lt (>) geq (<=) leq (>=) then (noop)
#> again (repeat)
#> 
#> User Definitions:
#> 

## Define a few new words
froth.parse(": MAKE_THREE 1 2 + . ;")
froth.parse(": MAKE_FIVE 2 3 + . ;")

## print out definition
writeFrothDictionary()
#> : MAKE_THREE 1 2 + . ;
#> : MAKE_FIVE 2 3 + . ;