mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 03:05:29 -05:00
aliases to existing functions
This commit is contained in:
parent
bebc312b85
commit
632a820b1d
2 changed files with 12 additions and 0 deletions
|
|
@ -129,6 +129,8 @@ let flatMap f seq =
|
||||||
from_iter
|
from_iter
|
||||||
(fun k -> seq (fun x -> (f x) k))
|
(fun k -> seq (fun x -> (f x) k))
|
||||||
|
|
||||||
|
let flat_map = flatMap
|
||||||
|
|
||||||
let fmap f seq =
|
let fmap f seq =
|
||||||
from_iter
|
from_iter
|
||||||
(fun k ->
|
(fun k ->
|
||||||
|
|
@ -136,6 +138,8 @@ let fmap f seq =
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some y -> k y))
|
| Some y -> k y))
|
||||||
|
|
||||||
|
let filter_map = fmap
|
||||||
|
|
||||||
(** Insert the given element between every element of the sequence *)
|
(** Insert the given element between every element of the sequence *)
|
||||||
let intersperse elem seq =
|
let intersperse elem seq =
|
||||||
fun k ->
|
fun k ->
|
||||||
|
|
|
||||||
|
|
@ -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
|
(** Monadic bind. Intuitively, it applies the function to every element of the
|
||||||
initial sequence, and calls {!concat}. *)
|
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
|
val fmap : ('a -> 'b option) -> 'a t -> 'b t
|
||||||
(** Specialized version of {!flatMap} for options. *)
|
(** 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
|
val intersperse : 'a -> 'a t -> 'a t
|
||||||
(** Insert the single element between every element of the sequence *)
|
(** Insert the single element between every element of the sequence *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue