Skip to content
generated from NatLabs/template.mo

A Buffer with the functionality of a Deque for efficient insertion and deletion at both ends.

License

Notifications You must be signed in to change notification settings

NatLabs/BufferDeque

Repository files navigation

BufferDeque

A Buffer with the functionality of a Deque for efficient insertion and deletion at both ends.

Installation

Install the package with mops:

mops add buffer-deque

Usage

import BufferDeque "mo:buffer-deque/BufferDeque";

let buffer = BufferDeque.BufferDeque(8);
buffer.addFront(2);
buffer.addBack(3);
buffer.addFront(1);

assert BufferDeque.toArray(buffer) == [1, 2, 3];

assert buffer.popFront() == ?1;
assert buffer.popBack() == ?3;

assert buffer.get(0) == 2;
assert BufferDeque.toArray(buffer) == [2];

Documentation

The documentation is available in the following formats:

About

A Buffer with the functionality of a Deque for efficient insertion and deletion at both ends.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published