aliases to existing functions

This commit is contained in:
Simon Cruanes 2014-07-01 15:54:00 +02:00
parent bebc312b85
commit 632a820b1d
2 changed files with 12 additions and 0 deletions

View file

@ -129,6 +129,8 @@ let flatMap f seq =
from_iter
(fun k -> seq (fun x -> (f x) k))
let flat_map = flatMap
let fmap f seq =
from_iter
(fun k ->
@ -136,6 +138,8 @@ let fmap f seq =
| None -> ()
| Some y -> k y))
let filter_map = fmap
(** Insert the given element between every element of the sequence *)
let intersperse elem seq =
fun k ->

View file

@ -145,9 +145,17 @@ val flatMap : ('a -> 'b t) -> 'a t -> 'b t
(** Monadic bind. Intuitively, it applies the function to every element of the
initial sequence, and calls {!concat}. *)
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
(** Alias to {!flatMap} with a more explicit name
@since NEXT_VERSION *)
val fmap : ('a -> 'b option) -> 'a t -> 'b t
(** Specialized version of {!flatMap} for options. *)
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
(** Alias to {!fmap} with a more explicit name
@since NEXT_VERSION *)
val intersperse : 'a -> 'a t -> 'a t
(** Insert the single element between every element of the sequence *)