Project

General

Profile

Revision 6fa45cb6 src/utils.ml

View differences:

src/utils.ml
361 361
let new_tag () =
362 362
  incr last_tag; !last_tag
363 363

  
364

  
365
module List =
366
struct
367
  include List 
368
  let iteri2 f l1 l2 =
369
    if List.length l1 <> List.length l2 then
370
      raise (Invalid_argument "iteri2: lists have different lengths")
371
    else
372
      let rec run idx l1 l2 =
373
	match l1, l2 with
374
	| [], [] -> ()
375
	| hd1::tl1, hd2::tl2 -> (
376
	  f idx hd1 hd2;
377
	  run (idx+1) tl1 tl2
378
	)
379
	| _ -> assert false
380
      in
381
      run 0 l1 l2
382
end
383

  
384
  
364 385
(* Local Variables: *)
365 386
(* compile-command:"make -C .." *)
366 387
(* End: *)

Also available in: Unified diff