mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 11:15:32 -05:00
Add from_labelled_iter
This commit is contained in:
parent
843103a6d2
commit
0b67b4641b
3 changed files with 10 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ type 'a hash = 'a -> int
|
||||||
(** Build an iterator from a iter function *)
|
(** Build an iterator from a iter function *)
|
||||||
let from_iter f = f
|
let from_iter f = f
|
||||||
|
|
||||||
|
let from_labelled_iter iter f = iter ~f
|
||||||
|
|
||||||
let rec from_fun f k = match f () with
|
let rec from_fun f k = match f () with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some x -> k x; from_fun f k
|
| Some x -> k x; from_fun f k
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ type 'a hash = 'a -> int
|
||||||
val from_iter : (('a -> unit) -> unit) -> 'a t
|
val from_iter : (('a -> unit) -> unit) -> 'a t
|
||||||
(** Build an iterator from a iter function *)
|
(** Build an iterator from a iter function *)
|
||||||
|
|
||||||
|
val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t
|
||||||
|
(** Build an iterator from a labelled iter function
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val from_fun : (unit -> 'a option) -> 'a t
|
val from_fun : (unit -> 'a option) -> 'a t
|
||||||
(** Call the function repeatedly until it returns None. This
|
(** Call the function repeatedly until it returns None. This
|
||||||
sequence is transient, use {!persistent} if needed! *)
|
sequence is transient, use {!persistent} if needed! *)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ type 'a hash = 'a -> int
|
||||||
val from_iter : (('a -> unit) -> unit) -> 'a t
|
val from_iter : (('a -> unit) -> unit) -> 'a t
|
||||||
(** Build an iterator from a iter function *)
|
(** Build an iterator from a iter function *)
|
||||||
|
|
||||||
|
val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t
|
||||||
|
(** Build an iterator from a labelled iter function
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val from_fun : (unit -> 'a option) -> 'a t
|
val from_fun : (unit -> 'a option) -> 'a t
|
||||||
(** Call the function repeatedly until it returns None. This
|
(** Call the function repeatedly until it returns None. This
|
||||||
sequence is transient, use {!persistent} if needed! *)
|
sequence is transient, use {!persistent} if needed! *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue