package pyml

  1. Overview
  2. Docs

Interface for Python values with a Sequence interface.

val check : Object.t -> bool

Wrapper for PySequence_Check

val concat : Object.t -> Object.t -> Object.t

Wrapper for PySequence_Concat

val contains : Object.t -> Object.t -> bool
val count : Object.t -> Object.t -> int

Wrapper for PySequence_Count

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

Wrapper for PySequence_DelItem

val fast : Object.t -> string -> Object.t

Wrapper for PySequence_Fast

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

Wrapper for PySequence_GetItem

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

Equivalent to get_item.

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

Wrapper for PySequence_Index

val in_place_concat : Object.t -> Object.t -> Object.t
val in_place_repeat : Object.t -> int -> Object.t
val length : Object.t -> int

Wrapper for PySequence_Length

val list : Object.t -> Object.t

Wrapper for PySequence_List

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

Wrapper for PySequence_Repeat

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

Wrapper for PySequence_SetItem

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

Equivalent to set_item.

val set_slice : Object.t -> int -> int -> Object.t -> unit
val size : Object.t -> int

Wrapper for PySequence_Size

val tuple : Object.t -> Object.t

Wrapper for PySequence_Tuple

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

to_array s returns the array with the same elements as the Python sequence s.

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

to_array_map f s returns the array of the results of f applied to all the elements of the Python sequence s.

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

to_list s returns the list with the same elements as the Python sequence s.

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

to_list_map f s returns the list of the results of f applied to all the elements of the Python sequence s. 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.

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

to_seq s returns the OCaml sequence of the values from the Python sequence s.

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

to_seqi s returns the OCaml indexed sequence of the values from the Python sequence s.

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

fold_left f v s returns (f (...(f v s1)...) sn) where s1, ..., sn are the elements of the Python sequence s.

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

fold_right f s v returns (f s1 (...(f v sn)...) where s1, ..., sn are the elements of the Python sequence s. This function is tail-recursive.

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

for_all p s checks if p holds for all the elements of the Python sequence s.

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

exists p s checks if p holds for at least one of the elements of the Python sequence s.

OCaml

Innovation. Community. Security.