let rec norm1 ?(acc = []) segs =
match segs with
| [] -> List.rev acc
| (("" as h)) :: (([] as t)) -> norm1 ~acc: (h :: acc) t
| ("" | ".") :: segs -> norm1 ~acc segs
| ((".." as seg)) :: segs ->
(match acc with
| [] | ".." :: _ -> norm1 ~acc: (seg :: acc) segs
| _ :: acc_tl -> norm1 ~acc: acc_tl segs)
| h :: t -> norm1 ~acc: (h :: acc) t