summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-05-18 13:08:31 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-05-18 13:08:31 -0700
commit2581ac99323ead839964e9b5f2a799cf61fd5bdc (patch)
treea733c96894f4e8fb37dffb964f57fd39d9996d08 /tests
parent92baa4f6bf99efe229abf2ab895cec8fd7a8936d (diff)
downloadsml-2581ac99323ead839964e9b5f2a799cf61fd5bdc.tar.zst
Allow pattern matching in function definitions.
Diffstat (limited to 'tests')
-rw-r--r--tests/18-fun-case.sml5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/18-fun-case.sml b/tests/18-fun-case.sml
new file mode 100644
index 0000000..d64b7d7
--- /dev/null
+++ b/tests/18-fun-case.sml
@@ -0,0 +1,5 @@
+fun fib 1 = 1
+ | fib 2 = 2
+ | fib n = __builtin "add" (fib (__builtin "sub" (n, 1)), fib (__builtin "sub" (n, 2)))
+
+val _ = __builtin "exit" (__builtin "add" (fib 8, 8))