diff options
Diffstat (limited to 'js/baba-yaga/scratch/baba/nested_when_test.baba')
-rw-r--r-- | js/baba-yaga/scratch/baba/nested_when_test.baba | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/baba-yaga/scratch/baba/nested_when_test.baba b/js/baba-yaga/scratch/baba/nested_when_test.baba new file mode 100644 index 0000000..a626634 --- /dev/null +++ b/js/baba-yaga/scratch/baba/nested_when_test.baba @@ -0,0 +1,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"; |