Nimony

The road to Nim 3

deques

nimony/lib/std/deques.nim

An implementation of a deque:idx: (double-ended queue). The underlying implementation uses a seq.

This is the Nimony port. The container is a growable, power-of-two ring buffer: elements are appended/prepended in amortized O(1) and indexed in O(1). Since exceptions are not yet wired up, accessing an element of an empty Deque (or an out-of-range index) is a broken precondition, expressed as a .requires contract, rather than raising IndexDefect.