X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=hlist.ml;h=4b836689099f5dfc81c2d1ec6259f39e09306002;hb=d550133ad7afdf65c5e284c2bcf67a5bdde6faa7;hp=cd3c90d81daa70faaf90d1600dd4b1cc37be1e74;hpb=479afaf5e67e28ef73c0126e95ca8badec3392aa;p=SXSI%2Fxpathcomp.git diff --git a/hlist.ml b/hlist.ml index cd3c90d..4b83668 100644 --- 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