package pyml

  1. Overview
  2. Docs

Interface for Python values of type Tuple.

val check : Object.t -> bool

check o returns true if o is a Python tuple.

val create : int -> Object.t

Wrapper for PyTuple_New

val empty : Object.t

The empty tuple (). This value is guaranteed to be the unique value associated to ().

val is_empty : Object.t -> bool

Py.is_empty v is true if and only if v is (). Since Py.Tuple.empty is guaranteed to be the unique value associated to (), Py.is_empty v is equivalent to v == Py.empty.

val get_item : Object.t -> int -> Object.t

Equivalent to Sequence.get_item.

val get : Object.t -> int -> Object.t

Equivalent to get_item.

val set_item : Object.t -> int -> Object.t -> unit

Wrapper for PyTuple_SetItem

val set : Object.t -> int -> Object.t -> unit

Equivalent to set_item.

val get_slice : Object.t -> int -> int -> Object.t

Wrapper for PyTuple_GetSlice

val size : Object.t -> int

Wrapper for PyTuple_Size

val init : int -> (int -> Object.t) -> Object.t

init n f returns the Python tuple (f 0, f 1, ..., f (n - 1)).

val of_array : Object.t array -> Object.t

of_array a returns the Python tuple with the same elements as a.

val of_array_map : ('a -> Object.t) -> 'a array -> Object.t

of_array_map f a returns the Python tuple (f a0, ..., f ak) where a0, ..., ak are the elements of a.

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

of_list l returns the Python tuple with the same elements as l.

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

of_list f l returns the Python tuple (f l1, ..., f ln) where l1, ..., ln are the elements of l. of_list_map f l is equivalent to of_list (List.map f l) but is tail-recursive.

val to_array : Object.t -> Object.t array

Equivalent to Sequence.to_array.

val to_array_map : (Object.t -> 'a) -> Object.t -> 'a array

Equivalent to Sequence.to_array_map.

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

Equivalent to Sequence.to_list.

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

Equivalent to Sequence.to_list_map.

val of_seq : Object.t Stdcompat.Seq.t -> Object.t

of_seq s returns the Python tuple with the values of the sequence s.

val to_seq : Object.t -> Object.t Stdcompat.Seq.t

Equivalent to Sequence.to_seq.

val to_seqi : Object.t -> (int * Object.t) Stdcompat.Seq.t

Equivalent to Sequence.to_seqi.

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

Equivalent to Sequence.fold_left.

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

Equivalent to Sequence.fold_right.

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

Equivalent to Sequence.for_all.

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

Equivalent to Sequence.exists.

val of_sequence : Object.t -> Object.t

Equivalent to Sequence.tuple.

val of_tuple1 : Object.t -> Object.t

of_tuple1 o0 returns the Python tuple (o0).

val of_tuple2 : (Object.t * Object.t) -> Object.t

of_tuple4 (o0, o1) returns the Python tuple (o0, o1).

val of_tuple3 : (Object.t * Object.t * Object.t) -> Object.t

of_tuple4 (o0, o1, o2) returns the Python tuple (o0, o1, o2).

val of_tuple4 : (Object.t * Object.t * Object.t * Object.t) -> Object.t

of_tuple4 (o0, o1, o2, o3) returns the Python tuple (o0, o1, o2, o3).

val of_tuple5 : (Object.t * Object.t * Object.t * Object.t * Object.t) -> Object.t

of_tuple5 (o0, o1, o2, o3, o4) returns the Python tuple (o0, o1, o2, o3, o4).

val to_tuple1 : Object.t -> Object.t

to_tuple1 t returns the value Py.Tuple.get_item t 0.

val to_tuple2 : Object.t -> Object.t * Object.t

to_tuple5 t returns the tuple (Py.Tuple.get_item t 0, Py.Tuple.get_item t 1).

val to_tuple3 : Object.t -> Object.t * Object.t * Object.t

to_tuple5 t returns the tuple (Py.Tuple.get_item t 0, Py.Tuple.get_item t 1, Py.Tuple.get_item t 2).

val to_tuple4 : Object.t -> Object.t * Object.t * Object.t * Object.t

to_tuple5 t returns the tuple (Py.Tuple.get_item t 0, Py.Tuple.get_item t 1, Py.Tuple.get_item t 2, Py.Tuple.get_item t 3).

val to_tuple5 : Object.t -> Object.t * Object.t * Object.t * Object.t * Object.t

to_tuple5 t returns the tuple (Py.Tuple.get_item t 0, Py.Tuple.get_item t 1, Py.Tuple.get_item t 2, Py.Tuple.get_item t 3, Py.Tuple.get_item t 4).

val singleton : Object.t -> Object.t

Equivalent to of_tuple1.

val to_singleton : Object.t -> Object.t

Equivalent to to_tuple1.

val of_pair : (Object.t * Object.t) -> Object.t

Equivalent to of_tuple2.

val to_pair : Object.t -> Object.t * Object.t

Equivalent to to_tuple2.