diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-09-08 10:18:19 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-09-08 10:18:19 -0400 |
commit | 747601bae6e91f226a2c1374ad96cef51f85617b (patch) | |
tree | 700a022259cb238d022c76cb0b6c30fb44985aed /lib/ur | |
parent | 8f032c5cdc1e1efbed9782c37feca90bf9e20ca3 (diff) |
dragList almost kinda works
Diffstat (limited to 'lib/ur')
-rw-r--r-- | lib/ur/list.ur | 10 | ||||
-rw-r--r-- | lib/ur/list.urs | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur index 3d4134ea..9e2550ca 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -44,6 +44,16 @@ fun foldlAbort [a] [b] f = foldlAbort' end +val length = fn [a] => + let + fun length' acc (ls : list a) = + case ls of + [] => acc + | _ :: ls => length' (acc + 1) ls + in + length' 0 + end + val rev = fn [a] => let fun rev' acc (ls : list a) = diff --git a/lib/ur/list.urs b/lib/ur/list.urs index ece85e8c..df1c8a52 100644 --- a/lib/ur/list.urs +++ b/lib/ur/list.urs @@ -8,6 +8,8 @@ val foldlAbort : a ::: Type -> b ::: Type -> (a -> b -> option b) -> b -> t a -> val foldlMapAbort : a ::: Type -> b ::: Type -> c ::: Type -> (a -> b -> option (c * b)) -> b -> t a -> option (t c * b) +val length : a ::: Type -> t a -> int + val rev : a ::: Type -> t a -> t a val revAppend : a ::: Type -> t a -> t a -> t a |