blob: a62663430e06ded3b528b077f520f3ef557c3eff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Test deeply nested when expressions
classify : x y ->
when x is
0 then when y is
0 then "origin"
1 then "y-axis"
_ then when y > 0 is
true then "positive y-axis"
false then "negative y-axis"
1 then when y is
0 then "x-axis"
1 then "diagonal"
_ then when y > 0 is
true then when y > 10 is
true then "far positive diagonal"
false then "close positive diagonal"
false then "negative diagonal"
_ then "other quadrant";
// Test with multiple discriminants and nesting
complexCase : a b c ->
when a b is
0 0 then when c is
1 then "case 1"
2 then when true is
true then "nested true"
false then "nested false"
_ then "default c"
1 _ then "partial match"
_ _ then "catch all";
|