let rec iteri xs ~f = match peek xs with | Some x -> f (count xs) x ; junk xs ; iteri xs ~f | None -> ()