Commits

Anonymous committed 31c7775

Cadastr.map_foldable: + #iter

Comments (0)

Files changed (1)

        functions will make possible mapping that preserves
        shadowed bindings). *)
     method fold : !'a . ('a -> 'k -> 'v -> 'a) -> 'a -> 'a;
+    method iter : ('k -> 'v -> unit) -> unit;
   end
 ;
 
               cur
               a
         ;
+        method iter f = Cd_List.List.rev_iter (fun (k, v) -> f k v) cur;
         method repr_kind = `Assoc_list;
         method to_arrays () = A.to_arrays cur;
       end
               cur
               a
             ;
+            value iter cur f = M.iter f cur;
             value empty = M.empty;
             value is_empty = M.is_empty;
 
              = fun f a ->
                  Cd_tree.fold cur f a
             ;
+            method iter f = Cd_tree.iter cur f;
             method to_arrays () = Cd_tree.to_arrays cur;
             method repr_kind = `Tree;
           end
             self#fold_prefix f init []
         ;
 
+        method iter f = self#fold (fun () k v -> f k v) ()
+        ;
+
         method dump
         : unit -> string
         = fun () ->
           (cur :> map_foldable _ _)#fold
         ;
 
+        method iter = cur#iter;
+
       end
     ;
 
           (cur :> map_foldable _ _)#fold
         ;
 
+        method iter = cur#iter;
+
         method add k v = cur := cur#add k v;
 
         (* method repr_kind = fu#repr_kind; *)