Idris2Doc : Data.BoundedQueue1.Unsized

Data.BoundedQueue1.Unsized

(source)
Linear Bounded Queues

Definitions

empty : Nat->F1s (BoundedQueue1sa)
  The empty `BoundedQueue1`. O(1)

Totality: total
Visibility: export
null : BoundedQueue1sa->F1sBool
  Is the `BoundedQueuei1` empty? O(1)

Totality: total
Visibility: export
fromList : Nat->Lista->F1s (BoundedQueue1sa)
  Naively keeps the first `n` values of a list, and converts
into a `BoundedQueue1` (keeps the order of the elements). O(1)

Totality: total
Visibility: export
fromSnocList : Nat->SnocLista->F1s (BoundedQueue1sa)
  Naively keeps the first `n` values of a `SnocList`, and converts
into a `BoundedQueue1` (keeps the order of the elements). O(1)

Totality: total
Visibility: export
toList : BoundedQueue1sa->F1s (Lista)
  Converts a `BoundedQueue1` to a `List`, keeping the order
of elements. O(n)

Totality: total
Visibility: export
toSnocList : BoundedQueue1sa->F1s (SnocLista)
  Converts a `BoundedQueue1` to a `SnocList`, keeping the order
of elements. O(n)

Totality: total
Visibility: export
enqueue : BoundedQueue1sa->a->F1sBool
  Append a value at the back of the `BoundedQueue1`.
This function returns `True` if the value was enqueued,
and `False` if the queue was full. O(1)

Totality: total
Visibility: export
dequeue : BoundedQueue1sa->F1s (Maybea)
  Take a value from the front of the `BoundedQueue1`. O(1)

Totality: total
Visibility: export
prepend : a->BoundedQueue1sa->F1sBool
  We can prepend an element to our `BoundedQueue1`, making it the new
"oldest" element. O(1)
This function returns `True` is the value was pre-pended,
and `False` if the queue was full. O(1)

Totality: total
Visibility: export
peekOldest : BoundedQueue1sa->F1s (Maybe (a, BoundedQueue1sa))
  Return the last element of the `BoundedQueue1`, plus the unmodified
queue.

Note: `peekOldest` might involve a rearrangement of the elements
just like `dequeue`. In order to keep our amortized O(1)
runtime behavior, the newly arranged queue should be used
henceforth.

Totality: total
Visibility: export
length : BoundedQueue1sa->F1sNat
  Returns the length of the `BoundedQueue1`. O(1).

Totality: total
Visibility: export