diff options
Diffstat (limited to 'lib/ur/listPair.ur')
-rw-r--r-- | lib/ur/listPair.ur | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ur/listPair.ur b/lib/ur/listPair.ur index 0182af19..d69993f9 100644 --- a/lib/ur/listPair.ur +++ b/lib/ur/listPair.ur @@ -33,3 +33,14 @@ fun all [a] [b] f = in all' end + +fun map2 [a] [b] [c] (f : a -> b -> c) = + let + fun map2' ls1 ls2 = + case (ls1, ls2) of + ([], []) => [] + | (x1 :: ls1, x2 :: ls2) => f x1 x2 :: map2' ls1 ls2 + | _ => error <xml>ListPair.map2: Unequal list lengths</xml> + in + map2' + end |