aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur/listPair.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-06-09 18:11:59 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-06-09 18:11:59 -0400
commitb7de8e9ac590f9d06df72d22489375b33a6efef9 (patch)
treefdefe678f8d11c1efad8dbe6d535da8ccb531f59 /lib/ur/listPair.ur
parent4c8297c1f381599333e998da585f4ef5ac24383b (diff)
Some standard library reorgs and additions; handle mutual datatypes better in Specialize
Diffstat (limited to 'lib/ur/listPair.ur')
-rw-r--r--lib/ur/listPair.ur14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ur/listPair.ur b/lib/ur/listPair.ur
index 8d1c873e..745e436c 100644
--- a/lib/ur/listPair.ur
+++ b/lib/ur/listPair.ur
@@ -1,3 +1,17 @@
+fun foldlPartial [a] [b] [c] f =
+ let
+ fun foldlPartial' acc ls1 ls2 =
+ case (ls1, ls2) of
+ ([], []) => Some acc
+ | (x1 :: ls1, x2 :: ls2) =>
+ (case f x1 x2 acc of
+ None => None
+ | Some acc' => foldlPartial' acc' ls1 ls2)
+ | _ => None
+ in
+ foldlPartial'
+ end
+
fun mapX [a] [b] [ctx ::: {Unit}] f =
let
fun mapX' ls1 ls2 =