pyml

OCaml bindings for Python
IN THIS PACKAGE
Module Py . List
val check : Object.t -> bool

check v returns true if v is a Python list.

val create : int -> Object.t

Wrapper for PyList_New

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 PyList_SetItem

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

Equivalent to set_item.

val size : Object.t -> int

Wrapper for PyList_Size

val length : Object.t -> int

Equivalent to size.

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

init n f returns the Python list [f 0, f 1, ..., f (n - 1)].

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

of_array a returns the Python list 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 list (f a0, ..., f ak) where a0, ..., ak are the elements of a.

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 of_list : Object.t list -> Object.t

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

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

of_list f l returns the Python list (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 and f is applied to the elements of l in the reverse order.

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 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.list.

of_seq s returns the Python list with the same elements as s.

Equivalent to Sequence.to_seq.

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

Equivalent to Sequence.to_seqi.

val singleton : Object.t -> Object.t

singleton o returns the Python list [o].