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
|
||||
(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 ->
|
||||
|
|
|
|||
|
|
@ -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 *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue