For the if-else-then fif functionality
For the if-else-then fif functionality
(condition-true? x)
Determines whether the given value is true or false
Notes:
Determines whether the given value is true or false Notes: - is true if it is a non-zero number - is false if it is the number zero - is true if (boolean x) is true
(conditional-mode sm)
Primitive if-else-then statements
Implementation Details:
entire control structure is placed in a sub-stack stored on the stash. Any inner control structures are processed by inner-conditional-mode
after being stored, the flag is processed, the stack machine is placed in either truth-condition-mode (flag was true) or dump-truth-condition-mode (flag was false), and the stashed condition body is placed back in the code queue, and the stash is cleared.
while in truth-condition-mode, args are processed naturally until a then statement pops it out of truth-condition-mode
while in dump-truth-condition-mode, args are dumped until the else (false condition) is reached, which places the stack machine in false-condition-mode.
Primitive if-else-then statements Implementation Details: - entire control structure is placed in a sub-stack stored on the stash. Any inner control structures are processed by inner-conditional-mode - after being stored, the flag is processed, the stack machine is placed in either truth-condition-mode (flag was true) or dump-truth-condition-mode (flag was false), and the stashed condition body is placed back in the code queue, and the stash is cleared. - while in truth-condition-mode, args are processed naturally until a then statement pops it out of truth-condition-mode - while in dump-truth-condition-mode, args are dumped until the else (false condition) is reached, which places the stack machine in false-condition-mode.
(dump-condition-mode sm)
Dumps the code stack, but stops upon reaching the end of the condition body (then).
Dumps the code stack, but stops upon reaching the end of the condition body (then).
(dump-truth-condition-mode sm)
Dumps the code stack, but stops upon reaching an else condition or upon reaching the end of the condition body (then). Nested conditionals are passed to dump-condition-mode.
Notes:
Dumps the code stack, but stops upon reaching an else condition or upon reaching the end of the condition body (then). Nested conditionals are passed to dump-condition-mode. Notes: - This mode is assumed to be a truth content dump, in order to process the false conditional body
(false-condition-mode sm)
Called when the code queue includes falsy content. This is normally called after the 'else clause.
Called when the code queue includes falsy content. This is normally called after the 'else clause.
(import-stdlib-conditional-mode sm)
Stack Machine imports for if-else-then functionality
Stack Machine imports for if-else-then functionality
(inner-conditional-mode sm)
For handling any inner if-else-then tokens, this tracks and converts them into a representation which won't impede parsing.
Notes:
For handling any inner if-else-then tokens, this tracks and converts them into a representation which won't impede parsing. Notes: - additional nested conditionals are tracked by pushing and popping additional :inner-conditional-mode flags
(start-if sm)
Word Definition: ? if <truth body> else <false body> then ? if <truth body> then
Word Definition: ? if <truth body> else <false body> then ? if <truth body> then
(truth-condition-mode sm)
Called when the code queue contains truthy content within the code queue. This is normally at the beginning of the conditional after the 'if clause.
Called when the code queue contains truthy content within the code queue. This is normally at the beginning of the conditional after the 'if clause.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close