środa, 22 września 2010

fold_map_try

  let rec fold_map_try f acc = function
    | [] -> [], acc
    | hd::tl ->
      let try (r, r_acc) = f hd acc in
      let r_tl, r_acc = fold_map_try f r_acc tl in
      r :: r_tl, r_acc
      with Not_found -> fold_map_try f acc tl

1 komentarz: