let map_nonempty_segs f segs = let rec loop segs = match segs with | [] -> [] | h :: t -> if h = "" then loop t else (f h) :: (loop t) in loop segs