Mercurial > urweb
diff lib/ur/list.ur @ 1057:eaba663fd6aa
Represent FFI function names as strings, to deal with cross-file recursion
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 05 Dec 2009 14:01:34 -0500 |
parents | 166ea3944b91 |
children | 52571ca9b777 |
line wrap: on
line diff
--- a/lib/ur/list.ur Thu Dec 03 14:32:47 2009 -0500 +++ b/lib/ur/list.ur Sat Dec 05 14:01:34 2009 -0500 @@ -21,7 +21,7 @@ mkEq eq' end -fun foldl [a] [b] f = +fun foldl [a] [b] (f : a -> b -> b) = let fun foldl' acc ls = case ls of @@ -31,6 +31,18 @@ foldl' end +val rev = fn [a] => + let + fun rev' acc (ls : list a) = + case ls of + [] => acc + | x :: ls => rev' (x :: acc) ls + in + rev' [] + end + +fun foldr [a] [b] f (acc : b) (ls : list a) = foldl f acc (rev ls) + fun foldlAbort [a] [b] f = let fun foldlAbort' acc ls = @@ -54,16 +66,6 @@ length' 0 end -val rev = fn [a] => - let - fun rev' acc (ls : list a) = - case ls of - [] => acc - | x :: ls => rev' (x :: acc) ls - in - rev' [] - end - fun foldlMapAbort [a] [b] [c] f = let fun foldlMapAbort' ls' acc ls =