diff demo/more/dlist.ur @ 964:fbc3a0eef45a

Paging mostly working; just need to get it working properly with filtering
author Adam Chlipala <adamc@hcoop.net>
date Sat, 19 Sep 2009 14:21:25 -0400
parents 6f9d1565de56
children e9c5992bc9bc
line wrap: on
line diff
--- a/demo/more/dlist.ur	Sat Sep 19 13:55:37 2009 -0400
+++ b/demo/more/dlist.ur	Sat Sep 19 14:21:25 2009 -0400
@@ -246,6 +246,20 @@
         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 =