package logtk

  1. Overview
  2. Docs
On This Page
  1. Immutable Arrays
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Logtk.IArraySource

Immutable Arrays

An API over arrays that doesn't expose any mutating function. This type 'a IArray.t benefits from good cache locality and fast access to items, but still is functional. However, most operations that create new arrays are linear in time (they copy/traverse the whole input).

Sourcetype 'a equal = 'a -> 'a -> bool
Sourcetype 'a ord = 'a -> 'a -> int
Sourcetype 'a t

Array of values of type 'a

Sourceval of_list : 'a list -> 'a t
Sourceval to_list : 'a t -> 'a list
Sourceval to_array_copy : 'a t -> 'a array

make a copy into a mutable array

Sourceval to_array_unsafe : 'a t -> 'a array

Show the underlying array. DO NOT MODIFY

Sourceval of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

Sourceval empty : 'a t
Sourceval length : _ t -> int
Sourceval singleton : 'a -> 'a t
Sourceval doubleton : 'a -> 'a -> 'a t
Sourceval make : int -> 'a -> 'a t
Sourceval init : int -> (int -> 'a) -> 'a t
Sourceval get : 'a t -> int -> 'a
Sourceval set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

Sourceval map : ('a -> 'b) -> 'a t -> 'b t
Sourceval map_arr : ('a -> 'b) -> 'a t -> 'b array
Sourceval mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
Sourceval mapi_arr : (int -> 'a -> 'b) -> 'a t -> 'b array
Sourceval append : 'a t -> 'a t -> 'a t
Sourceval iter : ('a -> unit) -> 'a t -> unit
Sourceval iteri : (int -> 'a -> unit) -> 'a t -> unit
Sourceval foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
Sourceval fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
Sourceval for_all : ('a -> bool) -> 'a t -> bool
Sourceval exists : ('a -> bool) -> 'a t -> bool
Sourceval equal : 'a equal -> 'a t equal
Sourceval compare : 'a ord -> 'a t ord
Sourceval hash : 'a Hash.t -> 'a t Hash.t
Sourceval hash_comm : 'a Hash.t -> 'a t Hash.t

Commutative hash

Sourceval to_seq : 'a t -> 'a Iter.t
Sourceval to_seqi : 'a t -> (int * 'a) Iter.t
Sourceval of_seq : 'a Iter.t -> 'a t
OCaml

Innovation. Community. Security.