F♭ (pronounced F-flat) is a toy language.
Converts a stack item to a “function” definition
deferStores a value in the dictionary that raises an error when executed. Used to allocate a word before it is used, for example in mutually-recursive
a: ->
f♭> a: defer
[ ]
; (def)stores a definition in the current dictionary
a: [A] ->
f♭> sqr: [ dup * ] ;
[ ]
useMove the contents of a map into scope
vocab{A} ->
f♭> { ... } use
[ ]
vocabWrite the current local vocabulary to the stack
-> {A}
f♭> vocab
[ { ... } ]
defined?returns true if the word is defined in the current vocabulary
a: -> bool
f♭> 'sqr' defined?
[ true ]
seerecalls the definition of a word as a string
a: -> str
f♭> 'sqr' see
[ '[ dup * ]' ]
showprints the definition of a word as a formatted string
a: ->
f♭> "sqr" show
[ dup * ]
[ ]
words-> [str*]
returns a list of defined words
locals-> [str*]
returns a list of locals words
scoped-> [str*]
returns a list of local scoped words
rewrite{A} [B] -> [C]
rewrites an expression using a set of rewrite rules