package tezos-benchmark

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Inference.NMapSource

Sourcetype t

The type of bijections.

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

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

Sourceval nth_exn : t -> int -> elt

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

Sourceval nth_opt : t -> int -> elt option

Same as nth_exn but returns None if out of range.

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

Sourceval idx_opt : t -> elt -> int option

See idx_opt

Sourceval support : t -> int

Returns the size of domain of the bijection.

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

Folds over the graph of the bijection.

OCaml

Innovation. Community. Security.