summaryrefslogtreecommitdiffstats
path: root/tests/190-list.sml
blob: de69c4a66087a540a018f5854926eb0649e0bafb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
infix 6 +

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))