comparison lib/ur/list.ur @ 916:b873feb3eb52

dragList almost kinda works
author Adam Chlipala <adamc@hcoop.net>
date Tue, 08 Sep 2009 10:18:19 -0400
parents ed06e25c70ef
children 166ea3944b91
comparison
equal deleted inserted replaced
915:5e8b6fa5b48f 916:b873feb3eb52
42 | Some acc' => foldlAbort' acc' ls 42 | Some acc' => foldlAbort' acc' ls
43 in 43 in
44 foldlAbort' 44 foldlAbort'
45 end 45 end
46 46
47 val length = fn [a] =>
48 let
49 fun length' acc (ls : list a) =
50 case ls of
51 [] => acc
52 | _ :: ls => length' (acc + 1) ls
53 in
54 length' 0
55 end
56
47 val rev = fn [a] => 57 val rev = fn [a] =>
48 let 58 let
49 fun rev' acc (ls : list a) = 59 fun rev' acc (ls : list a) =
50 case ls of 60 case ls of
51 [] => acc 61 [] => acc