fun add(a,b) =
a + b
val sum = foldl(add, 0, [1,2,3,4])
val sum = foldl(op+, 0, [1,2,3,4])
fun range(min, maxExclusive) =
if min>=maxExclusive
then []
else min::range(min+1, maxExclusive)
val xs = range(1, 5)
val sum_a = foldl op+ 0 xs
val sum_b = foldl op+ 0 range(1, 5)
fun to_x(x, _) =
x
val xys = [(10,20), (30,40), (50, 60)]
val xs = map xys to_x
val sum_xs = foldl op+ 0 xs
val xys = [(10,20), (30,40), (50, 60)]
val xs = map xys #1
val sum_xs = foldl op+ 0 xs
val map_function = map
val filter_function_requires_list_module = filter (* requires List.filter *)
val fold_left_function = foldl
val fold_right_function = foldr
val find_function_requires_list_module = find (* requires List.find *)
val list_map_function_also_works = List.map
val list_foldl_function_also_works = List.foldl
val list_foldr_function_also_works = List.foldr