Commit f92be5d1 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Rename [map_opt] to [filter_map] for clarity.

parent 41e8047e
......@@ -483,7 +483,7 @@ let unthingify_parameter rules thing =
if StringMap.mem symbol rules then Some param else None
let unthingify_attribute_declaration rules (params, attrs) =
(Misc.map_opt (unthingify_parameter rules) params, attrs)
(Misc.filter_map (unthingify_parameter rules) params, attrs)
let unthingify_attribute_declarations rules decls =
List.map (unthingify_attribute_declaration rules) decls
......
......@@ -286,7 +286,7 @@ let mk_stretch pos1 pos2 parenthesize monsters =
stretch_linecount = pos2.pos_lnum - pos1.pos_lnum;
stretch_content = content;
stretch_raw_content = raw_content;
stretch_keywords = Misc.map_opt (fun monster -> monster.keyword) monsters
stretch_keywords = Misc.filter_map (fun monster -> monster.keyword) monsters
})
(* Creating a stretch from a located identifier. (This does not require the
......
......@@ -216,9 +216,9 @@ let postincrement r =
r := x + 1;
x
(* [map_opt f l] returns the list of [y]s such that [f x = Some y] where [x]
(* [filter_map f l] returns the list of [y]s such that [f x = Some y] where [x]
is in [l], preserving the order of elements of [l]. *)
let map_opt f l =
let filter_map f l =
List.(rev (fold_left (fun ys x ->
match f x with
| None -> ys
......
......@@ -124,9 +124,9 @@ val normalize: string -> string
val postincrement: int ref -> int
(* [map_opt f l] returns the list of [y]s such that [f x = Some y] where [x]
(* [filter_map f l] returns the list of [y]s such that [f x = Some y] where [x]
is in [l], preserving the order of elements of [l]. *)
val map_opt : ('a -> 'b option) -> 'a list -> 'b list
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
(* [new_encode_decode capacity] creates a new service for assigning unique
integer codes to strings. [capacity] is the initial capacity of the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment