Skip to content

Cond

Name - Description Default Type
<input> The value that will be passed to each predicate and action to execute. Any
<output> The input of the shard if Passthrough is true; otherwise, the output of the action of the first matching condition. Any
Wires A sequence of shards, interleaving condition test predicate and action to execute if the condition matches. None [Shard [Shard] None]
Passthrough The output of this shard will be its input. true Bool
Threading Will not short circuit after the first true test expression. The threaded value gets used in only the action and not the test part of the clause. false Bool

Takes a sequence of conditions and predicates. Evaluates each condition one by one and if one matches, executes the associated action.

Examples

1
2
3
4
5
6
7
8
9
0.5
(Cond
 [(-> (IsMore 0.7)) (-> "fast")
  (-> (IsLess 0.3)) (-> "slow")
  ; last case acts as default
  (-> true) (-> "normal")]
 ;:Passthrough
 false)
(Assert.Is "normal" true)