let rec drop_whilei xs ~f = match peek xs with | Some x when f (count xs) x -> junk xs ; drop_whilei xs ~f | _ -> ()