package pyml

  1. Overview
  2. Docs

Module Py.ListSource

Interface for Python values of type List.

Sourceval check : Object.t -> bool

check v returns true if v is a Python list.

Sourceval create : int -> Object.t

Wrapper for PyList_New

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

Equivalent to Sequence.get_item.

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

Equivalent to get_item.

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

Wrapper for PyList_SetItem

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

Equivalent to set_item.

Sourceval size : Object.t -> int

Wrapper for PyList_Size

Sourceval length : Object.t -> int

Equivalent to size.

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

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

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

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

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

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

Equivalent to Sequence.to_array.

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

Equivalent to Sequence.to_array_map.

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

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

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

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

Equivalent to Sequence.to_list.

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

Equivalent to Sequence.to_list_map.

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

Equivalent to Sequence.fold_left.

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

Equivalent to Sequence.fold_right.

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

Equivalent to Sequence.for_all.

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

Equivalent to Sequence.exists.

Sourceval of_sequence : Object.t -> Object.t

Equivalent to Sequence.list.

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

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

Equivalent to Sequence.to_seqi.

Sourceval singleton : Object.t -> Object.t

singleton o returns the Python list [o].

OCaml

Innovation. Community. Security.