comparison lib/ur/listPair.ur @ 850:1c2f335297b7

Fix a variable capture bug in nested JavaScript; some more list stuff
author Adam Chlipala <adamc@hcoop.net>
date Tue, 16 Jun 2009 17:52:44 -0400
parents 0d30e6338c65
children 5c30eea7aa78
comparison
equal deleted inserted replaced
849:e571fb150a9f 850:1c2f335297b7
1 fun foldlPartial [a] [b] [c] f = 1 fun foldlAbort [a] [b] [c] f =
2 let 2 let
3 fun foldlPartial' acc ls1 ls2 = 3 fun foldlAbort' acc ls1 ls2 =
4 case (ls1, ls2) of 4 case (ls1, ls2) of
5 ([], []) => Some acc 5 ([], []) => Some acc
6 | (x1 :: ls1, x2 :: ls2) => 6 | (x1 :: ls1, x2 :: ls2) =>
7 (case f x1 x2 acc of 7 (case f x1 x2 acc of
8 None => None 8 None => None
9 | Some acc' => foldlPartial' acc' ls1 ls2) 9 | Some acc' => foldlAbort' acc' ls1 ls2)
10 | _ => None 10 | _ => None
11 in 11 in
12 foldlPartial' 12 foldlAbort'
13 end 13 end
14 14
15 fun mapX [a] [b] [ctx ::: {Unit}] f = 15 fun mapX [a] [b] [ctx ::: {Unit}] f =
16 let 16 let
17 fun mapX' ls1 ls2 = 17 fun mapX' ls1 ls2 =