This library some useful data structures

lang/data


Queue

Implementation of a single-ended queue.
Supports in operator and iteration

Fields

None

Methods
void add(this, object obj)

Add object to back of queue

void clear(this)
object peek(this)

Get object from front without popping it.
If queue is empty, null is returned

object pop(this)

Pop object from front.
If queue is empty, null is returned

num size(this)

Deque

Implementation of a double-ended queue.
Supports in operator and iteration

Fields

None

Methods
void addBack(this, object obj)

Add object to back of queue

void addFront(this, object obj)

Add object to front of queue

void clear(this)
object peekBack(this)

Get object from front without popping it.
If queue is empty, null is returned

object peekFront(this)

Get object from front without popping it.
If queue is empty, null is returned

object popBack(this)

Pop object from back.
If queue is empty, null is returned

object popFront(this)

Pop object from front.
If queue is empty, null is returned

num size(this)

Set

Implementation of a set.
Can contain only booleans, strings and numbers
Supports in operator, equality check and iteration

Fields

None

Methods
_constructor(this, list | void values)

Constructs an empty set and adds all values (if specified)

void add(this, bool | string | num obj)

Add object to set. If object is already in set - nothing happens

void clear(this)
object static intersection(a, b)
Static

Intersection of 2 sets

void remove(this, bool | string | num obj)

Remove object from set. If object is not in set - nothing happens

num size(this)
object static union(a, b)
Static

Union of 2 sets

Bytes

Implementation of a byte array.
Supports equality check, iteration, indexing and subscripts

Fields

None

Methods
object static and(string | object a, string | object b)
Static
string static asBase64(string | object bytes)
Static
num static asBits(string | object bytes)
Static
num static asSignedInt(string | object bytes)
Static
num static asUnsignedInt(string | object bytes)
Static
bool bitAt(this, num pos)
object static fromBase64(string b64)
Static
object static fromBits(string bits)
Static
object static fromSignedInt(num uint)
Static
object static implies(string | object a, string | object b)
Static
object static nand(string | object a, string | object b)
Static
object static nor(string | object a, string | object b)
Static
object static or(string | object a, string | object b)
Static
void setBitAt(this, num pos, bool bit)
object static xnor(string | object a, string | object b)
Static
object static xor(string | object a, string | object b)
Static