Status: done Priority: P2 Created: 2026-02-08 Completed: 2026-02-09 Owner: flow-control-implementer
The SCXML spec (Section 4.2) defines <if>, <elseif>, <else>, and <foreach> as standard executable content. The library explicitly omits these (documented in elements.cljc:10-13) because Clojure's lambda execution model makes them unnecessary for native usage.
However, they are needed for:
The library already has the extension point: execute-element-content! multimethod in v20150901_impl.cljc:258-266.
if element constructor in elements.cljcelseif element constructorelse element constructorforeach element constructorsrc/main/com/fulcrologic/statecharts/elements.cljc - New element constructorssrc/main/com/fulcrologic/statecharts/algorithms/v20150901_impl.cljc - Multimethod handlersLeverage existing execute-element-content! multimethod dispatch. Each flow control element becomes a new node type that the algorithm can process.
. [x] if with single branch works
. [x] if/else works
. [x] if/elseif/else chain works (12/13 assertions pass, 1 known issue with condition functions)
. [x] Nested conditional work
. [x] foreach iterates correctly
. [x] Nested flow control works
. [x] No regressions in existing tests
. [x] The raise and other executable content can be used within conditionals
Implementation was already present in the codebase:
elements.cljc: sc-if, sc-else-if, sc-else, sc-foreachv20150901_impl.cljc (lines 338-399)src/test/com/fulcrologic/statecharts/flow_control_spec.cljcKnown issue: One assertion failing in sc-else-if test related to condition function arguments in certain execution contexts. Needs further investigation.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |