Higher order word. Takes a StackProgram and returns it as StackFn to be used like any word. Unknown stack effect.
If the optional env
is given, uses a shallow copy of that environment (one per invocation) instead of the current one passed by run at runtime. If mergeEnv
is true (default), the user provided env will be merged with the current env (also shallow copies). This is useful in conjunction with pushenv and store or storekey()
to save results of sub procedures in the main env.
Note: The provided (or merged) env is only active within the execution scope of the word.
( ? -- ? )
-
-
-
Like {@link word}, but automatically calls unwrap on result context to produced unwrapped value/tuple.
Importatant: Words defined with this function CANNOT be used as part of a larger stack program, only for standalone use.
-
-
-
-
Executes TOS as stack function and places result back on d-stack. TOS MUST be a valid word or quotation.
( x -- x() )
-
Expects TOS to be a quotation with a vanilla JS function as first element. Calls fn with all remaining items in quot as arguments and pushes result back on d-stack (even if fn returned undefined
).
( [f ...] -- f(...) )
-
Generated using TypeDoc
Expects a body and error handler quotation on stack. Executes body within an implicit
try .. catch
and if an error was thrown pushes it on stack and executes error quotation.( body catch -- ? )