package tezos-benchmark

  1. Overview
  2. Docs
type t

The type of bijections.

type elt = Free_variable.t

The type of elements in bijection with {0; ..; n-1}.

val of_list : elt list -> t

of_list l Constructs a bijection between l and {0; ...; n-1}. The bijection is constructed by assigning to the elements l0, l1, ..., ln-1 the indices {0; 1; ...; n-1}.

val nth_exn : t -> int -> elt

Get the nth element out of the bijection. This is O(1).

val nth_opt : t -> int -> elt option

Same as nth_exn but returns None if out of range.

val idx_exn : t -> elt -> int

Returns the index of a given element. This is O(log2(n)) for a set with n elements when using the map-based implementation.

  • raises Not_found

    if element is not in the domain of the bijection.

val idx_opt : t -> elt -> int option

See idx_opt

val support : t -> int

Returns the size of domain of the bijection.

val fold : (elt -> int -> 'a -> 'a) -> t -> 'a -> 'a

Folds over the graph of the bijection.

OCaml

Innovation. Community. Security.