add Sequence.flat_map_l

This commit is contained in:
Simon Cruanes 2016-04-08 16:35:16 +02:00
parent 5ad86a8b04
commit 2c82c3b135
2 changed files with 7 additions and 0 deletions

View file

@ -92,6 +92,9 @@ let flatMap f seq k = seq (fun x -> f x k)
let flat_map = flatMap let flat_map = flatMap
let flat_map_l f seq k =
seq (fun x -> List.iter k (f x))
let fmap f seq k = let fmap f seq k =
seq (fun x -> match f x with seq (fun x -> match f x with
| None -> () | None -> ()

View file

@ -158,6 +158,10 @@ val flat_map : ('a -> 'b t) -> 'a t -> 'b t
element of the initial sequence, and calls {!concat}. element of the initial sequence, and calls {!concat}.
@since 0.5 *) @since 0.5 *)
val flat_map_l : ('a -> 'b list) -> 'a t -> 'b t
(** Convenience function combining {!flat_map} and {!of_list}
@since NEXT_RELEASE *)
val fmap : ('a -> 'b option) -> 'a t -> 'b t val fmap : ('a -> 'b option) -> 'a t -> 'b t
(** @deprecated use {!filter_map} since 0.6 *) (** @deprecated use {!filter_map} since 0.6 *)