5.1 Conditionals
Static information is gathered from then_body and else_body under the same conditions as the right-hand side of def (see Rules for Static Information), and the information is intersected to determine the static information of the if form.
> if #true
| "yes"
| "no"
"yes"
yep
| "no"
"yes"
expression | ||||||||
| ||||||||
| ||||||||
expression | ||||||||
| ||||||||
| ||||||||
expression | ||||||||
|
If no clause_test_expr produces a true value and there is no ~else clause, a run-time exception is thrown.
Static information is gathered from clause_result_bodys or clause_result_expr under the same conditions as the right-hand side of def (see Rules for Static Information), and the information is intersected to determine the static information of the cond form.
> when #true
| println("yes")
yes
> when #false
| println("no")
> unless #true
| println("yes")
> unless #false
| println("no")
no
Because the bindings of bind must be made available for expr, a when or unless binding is not compatible for use with let, unless the set of names from bind is empty.
> classify(1)
"odd"
> classify(2)
"even"
> classify([1, 2])
"other value"