package pyml

  1. Overview
  2. Docs

Module Py.IterSource

Interface for Python values of type Iter.

Sourceval check : Object.t -> bool

check o returns true if o is an iterator.

Sourceval next : Object.t -> Object.t option

next i returns the next value from the iteration i. If there are no remaining values, returns None. Wrapper for PyIter_Next.

Sourceval iter : (Object.t -> unit) -> Object.t -> unit

iter f i iteratively calls f v with all the remaining values of the iteration i.

Sourceval to_list : Object.t -> Object.t list

to_list i returns the list of all the remaining values from the iteration i.

Sourceval to_list_map : (Object.t -> 'a) -> Object.t -> 'a list

to_list_map f i returns the list of the results of f applied to all the remaining values from the iteration i. to_list_map f s is equivalent to List.map f (to_list s) but is tail-recursive and f is applied to the elements of s in the reverse order.

of_seq s returns an interator that iterates over the values of the sequence s.

Sourceval of_seq_map : ('a -> Object.t) -> 'a Stdcompat.Seq.t -> Object.t

of_seq_map f s returns an interator that iterates over the results of f applied to the values of the sequence s. Py.Iter.of_seq_map f s is equivalent to Py.Iter.of_seq (Seq.map f s).

to_seq i returns the sequence of the values from the iteration i. The Python iteration is consumed while the sequence is browsed. Values are memoized, so that the sequence can be browsed many times.

Sourceval to_seq_map : (Object.t -> 'a) -> Object.t -> 'a Stdcompat.Seq.t

to_seq_map f i returns the sequence of the results of f applied to the values from the iteration i. The Python iteration is consumed while the sequence is browsed. Values are memoized, so that the sequence can be browsed many times.

Sourceval unsafe_to_seq : Object.t -> Object.t Stdcompat.Seq.t

unsafe_to_seq i returns the sequence of the values from the iteration i. The Python iteration is consumed while the sequence is browsed. Warning: values are not memoized, so that the sequence can be browsed only once.

Sourceval unsafe_to_seq_map : (Object.t -> 'a) -> Object.t -> 'a Stdcompat.Seq.t

unsafe_to_seq_map f i returns the sequence of the results of f applied to the values from the iteration i. The Python iteration is consumed while the sequence is browsed. Warning: values are not memoized, so that the sequence can be browsed only once.

Sourceval of_list : Object.t list -> Object.t

of_list l returns an interator that iterates over the values of the list l.

Sourceval of_list_map : ('a -> Object.t) -> 'a list -> Object.t

of_list_map f l returns an interator that iterates over the results of f applied to the values of the list l. Py.Iter.of_list_map f s is equivalent to Py.Iter.of_list (List.map f s) but is tail-recursive.

Sourceval fold_left : ('a -> Object.t -> 'a) -> 'a -> Object.t -> 'a

fold_left f v i returns (f (...(f v i1)...) in) where i1, ..., in are the remaining values from the iteration i.

Sourceval fold_right : (Object.t -> 'a -> 'a) -> Object.t -> 'a -> 'a

fold_right f i v returns (f i1 (...(f v in)...) where i1, ..., in are the remaining values from the iteration i. This function is not tail-recursive.

Sourceval for_all : (Object.t -> bool) -> Object.t -> bool

for_all p i checks if p holds for all the remaining values from the iteration i.

Sourceval exists : (Object.t -> bool) -> Object.t -> bool

exists p i checks if p holds for at least one of the remaining values from the iteration i.

Sourceval create : (unit -> Object.t option) -> Object.t

create next returns an iterator that calls next.

Sourceval seq_iter : Object.t -> Object.t

Wrapper for PySeqIter_New

Sourceval call_iter : Object.t -> Object.t -> Object.t

Wrapper for PyCallIter_New

Sourceval create_call : (unit -> Object.t option) -> Object.t

create_call next returns an iterator that calls next. The difference with create is that this uses PyCallIter_New rather than creating an object and use the __next__ method.

OCaml

Innovation. Community. Security.