Commit before branching to new XPath compilation
[SXSI/xpathcomp.git] / hlist.ml
index cd3c90d..4b83668 100644 (file)
--- a/hlist.ml
+++ b/hlist.ml
@@ -16,6 +16,7 @@ module type S = sig
   val iter : (elt -> 'a) -> t -> unit
   val rev : t -> t
   val rev_map : (elt -> elt) -> t -> t
+  val length : t -> int
 end
 
 module Make ( H : Hcons.S ) : S with type elt = H.t =
@@ -78,5 +79,5 @@ struct
        
   let rev l = fold cons l nil
   let rev_map f l = fold (fun x acc -> cons (f x) acc) l nil
-         
+  let length l = fold (fun _ c -> c+1) l 0 
 end