package extlib

  1. Overview
  2. Docs
A complete yet small extension for OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

extlib-1.8.0.tar.gz
md5=43fb3bf2989671af1769147b1171d080
sha512=dedd2bb4a63f2df9e451dbe6aede18d873489a8675f48ded09131f2af4d00dbeaecc8750039b2e4facb9f5f9b1b01c6b7accd392bf8ac5a3f2c801562ce5c4ee

doc/extlib/BitSet/index.html

Module BitSetSource

Efficient bit sets.

A bitset is an array of boolean values that can be accessed with indexes like an array but provides a better memory usage (divided by 8) for a very small speed trade-off.

Sourcetype t
Sourceexception Negative_index of string

When a negative bit value is used for one of the BitSet functions, this exception is raised with the name of the function.

Sourceval empty : unit -> t

Create an empty bitset of size 0, the bitset will automatically expand when needed.

Sourceval create : int -> t

Create an empty bitset with an initial size (in number of bits).

Sourceval copy : t -> t

Copy a bitset : further modifications of first one will not affect the copy.

Sourceval clone : t -> t

Same as copy

Sourceval set : t -> int -> unit

set s n sets the nth-bit in the bitset s to true.

Sourceval unset : t -> int -> unit

unset s n sets the nth-bit in the bitset s to false.

Sourceval put : t -> bool -> int -> unit

put s v n sets the nth-bit in the bitset s to v.

Sourceval toggle : t -> int -> unit

toggle s n changes the nth-bit value in the bitset s.

Sourceval is_set : t -> int -> bool

is_set s n returns true if nth-bit in the bitset s is set, or false otherwise.

Sourceval compare : t -> t -> int

compare s1 s2 compares two bitsets. Highest bit indexes are compared first.

Sourceval equals : t -> t -> bool

equals s1 s2 returns true if, and only if, all bits values in s1 are the same as in s2.

Sourceval count : t -> int

count s returns the number of bits set in the bitset s.

Sourceval enum : t -> int Enum.t

enum s returns an enumeration of bits which are set in the bitset s.

Sourceval intersect : t -> t -> unit

intersect s t sets s to the intersection of the sets s and t.

Sourceval unite : t -> t -> unit

unite s t sets s to the union of the sets s and t.

Sourceval differentiate : t -> t -> unit

differentiate s t removes the elements of t from s.

Sourceval differentiate_sym : t -> t -> unit

differentiate_sym s t sets s to the symmetrical difference of the sets s and t.

Sourceval inter : t -> t -> t

inter s t returns the intersection of sets s and t.

Sourceval union : t -> t -> t

union s t return the union of sets s and t.

Sourceval diff : t -> t -> t

diff s t returns s-t.

Sourceval sym_diff : t -> t -> t

sym_diff s t returns the symmetrical difference of s and t.

OCaml

Innovation. Community. Security.