summaryrefslogtreecommitdiff
path: root/demo/more/dlist.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-19 14:21:25 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-19 14:21:25 -0400
commit142e0b28763660019a6fc0fc4a9383fb43b77407 (patch)
tree0f7d66a99a62a66dbf3199febbcac8be00eb0650 /demo/more/dlist.ur
parentc9c3eaa4c489077ef0199eacc16674b328348734 (diff)
Paging mostly working; just need to get it working properly with filtering
Diffstat (limited to 'demo/more/dlist.ur')
-rw-r--r--demo/more/dlist.ur14
1 files changed, 14 insertions, 0 deletions
diff --git a/demo/more/dlist.ur b/demo/more/dlist.ur
index 1a5be7e3..fe0cdd07 100644
--- a/demo/more/dlist.ur
+++ b/demo/more/dlist.ur
@@ -246,6 +246,20 @@ fun elements [t] (dl : dlist t) =
Empty => return []
| Nonempty {Head = hd, ...} => elements' hd
+fun size' [t] (dl'' : dlist'' t) =
+ case dl'' of
+ Nil => return 0
+ | Cons (x, dl'') =>
+ dl'' <- signal dl'';
+ n <- size' dl'';
+ return (n + 1)
+
+fun size [t] (dl : dlist t) =
+ dl' <- signal dl;
+ case dl' of
+ Empty => return 0
+ | Nonempty {Head = hd, ...} => size' hd
+
fun foldl [t] [acc] (f : t -> acc -> signal acc) =
let
fun foldl'' (i : acc) (dl : dlist'' t) : signal acc =