summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-05-18 07:23:38 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-05-18 16:23:10 -0700
commit3a498db5a485a3ed7014e3016c92e0ac64c4b73b (patch)
treecbdc711d900da4d45581e66dab06638d26c0d069 /tests
parent2581ac99323ead839964e9b5f2a799cf61fd5bdc (diff)
downloadsml-3a498db5a485a3ed7014e3016c92e0ac64c4b73b.tar.zst
Improve support for infix operators.
Diffstat (limited to 'tests')
-rw-r--r--tests/19-list.sml11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/19-list.sml b/tests/19-list.sml
new file mode 100644
index 0000000..52404dc
--- /dev/null
+++ b/tests/19-list.sml
@@ -0,0 +1,11 @@
+infix 6 +
+infixr 5 ::
+
+datatype 'a list = Nil | :: of 'a * 'a list
+
+fun x + y = __builtin "add" (x, y)
+
+fun foldl _ acc Nil = acc
+ | foldl f acc (x :: xs) = foldl f (f (x, acc)) xs
+
+val _ = __builtin "exit" (foldl op + 0 (1 :: 2 :: 3 :: 6 :: 8 :: 10 :: 12 :: Nil))