Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "cond"

Index

Functions

Const casesq

Const condq

Const defCases

  • defCases(cases: IObjectOf<StackProc>): (Anonymous function)
  • Higher order word. Takes an object of stack programs with keys in the object being used to check for equality with TOS. If a match is found, executes corresponding stack program. If a default key is specified and no other cases matched, run default program. In all other cases throws an error.

    Important: The default case has the original TOS re-added to the d-stack before execution.

    Parameters

    Returns (Anonymous function)

Const defCond

  • Higher order word. Takes two stack programs: truthy and falsey branches, respectively. When executed, pops TOS and runs only one of the branches depending if TOS was truthy or not.

    Note: Unlike JS if() {...} else {...} constructs, the actual conditional is NOT part of this word.

    ( bool -- ? )

    Parameters

    Returns (Anonymous function)

Const whenq

Generated using TypeDoc