let iteri f tree = let rec aux i { content = t ; children = l } = f t l i ; List.iter (aux (succ i)) l in aux 0 tree