package pyml

  1. Overview
  2. Docs

Module Py.SequenceSource

Interface for Python values with a Sequence interface.

Sourceval check : Object.t -> bool

Wrapper for PySequence_Check

Sourceval concat : Object.t -> Object.t -> Object.t

Wrapper for PySequence_Concat

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

Wrapper for PySequence_Count

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

Wrapper for PySequence_DelItem

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

Wrapper for PySequence_Fast

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

Wrapper for PySequence_GetItem

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

Equivalent to get_item.

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

Wrapper for PySequence_Index

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

Wrapper for PySequence_Length

Sourceval list : Object.t -> Object.t

Wrapper for PySequence_List

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

Wrapper for PySequence_Repeat

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

Wrapper for PySequence_SetItem

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

Equivalent to set_item.

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

Wrapper for PySequence_Size

Sourceval tuple : Object.t -> Object.t

Wrapper for PySequence_Tuple

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

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

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

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

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

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

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

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

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

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

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

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