Skip to content
Matt Fichman edited this page Dec 20, 2012 · 8 revisions

Implementation of an array-based FIFO queue (uses a circular buffer that resizes when the queue is full).

@init(capacity Int)

Creates a new queue with capacity for 'capacity' elements. The queue will resize beyond 'capacity' elements if necessary; the capacity is just a hint to the implementation.

Releases memory used by the queue.

enq(element :a)

Adds an element at the end of the queue.

deq() :a

Removes and returns the element at the head of the queue.

Returns the first element in the queue.

last?() :a

Returns the last element in the queue.

Returns true if the queue is empty.

No comment

No comment

No comment

No comment

Clone this wiki locally