Module "Dequeue.curry"

An implementation of double-ended queues supporting access at both ends in constant amortized time.

Author: Bernd Brassel, Olaf Chitil, Michael Hanus, Sebastian Fischer

Version: October 2006


 Exported names:

Datatypes:
Queue

Functions:
cons | deqHead | deqInit | deqLast | deqLength | deqReverse | deqTail | deqToList | empty | isEmpty | listToDeq | matchHead | matchLast | rotate | snoc


 Summary of exported functions:

empty  :: Queue a  deterministic 
          The empty queue.
isEmpty  :: Queue a -> Bool  deterministic flexible
          Is the queue empty?
deqHead  :: Queue a -> a  deterministic flexible+rigid
          The first element of the queue.
deqLast  :: Queue a -> a  deterministic flexible+rigid
          The last element of the queue.
cons  :: a -> Queue a -> Queue a  deterministic flexible
          Inserts an element at the front of the queue.
deqTail  :: Queue a -> Queue a  deterministic flexible
          Removes an element at the front of the queue.
snoc  :: a -> Queue a -> Queue a  deterministic flexible
          Inserts an element at the end of the queue.
deqInit  :: Queue a -> Queue a  deterministic flexible
          Removes an element at the end of the queue.
deqReverse  :: Queue a -> Queue a  deterministic flexible
          Reverses a double ended queue.
listToDeq  :: [a] -> Queue a  deterministic 
          Transforms a list to a double ended queue.
deqToList  :: Queue a -> [a]  deterministic flexible
          Transforms a double ended queue to a list.
deqLength  :: Queue a -> Int  deterministic flexible
          Returns the number of elements in the queue.
rotate  :: Queue a -> Queue a  deterministic 
          Moves the first element to the end of the queue.
matchHead  :: Queue a -> Maybe (a,Queue a)  deterministic flexible
          Matches the front of a queue.
matchLast  :: Queue a -> Maybe (a,Queue a)  deterministic flexible
          Matches the end of a queue.

 Imported modules:

Prelude

 Exported datatypes:

Queue

The datatype of a queue.

Constructors:



 Exported functions:

empty :: Queue a  deterministic 

The empty queue.

Further infos:
  • solution complete, i.e., able to compute all solutions

isEmpty :: Queue a -> Bool  deterministic flexible

Is the queue empty?


deqHead :: Queue a -> a  deterministic flexible+rigid

The first element of the queue.


deqLast :: Queue a -> a  deterministic flexible+rigid

The last element of the queue.


cons :: a -> Queue a -> Queue a  deterministic flexible

Inserts an element at the front of the queue.


deqTail :: Queue a -> Queue a  deterministic flexible

Removes an element at the front of the queue.


snoc :: a -> Queue a -> Queue a  deterministic flexible

Inserts an element at the end of the queue.


deqInit :: Queue a -> Queue a  deterministic flexible

Removes an element at the end of the queue.


deqReverse :: Queue a -> Queue a  deterministic flexible

Reverses a double ended queue.

Further infos:
  • solution complete, i.e., able to compute all solutions

listToDeq :: [a] -> Queue a  deterministic 

Transforms a list to a double ended queue.


deqToList :: Queue a -> [a]  deterministic flexible

Transforms a double ended queue to a list.


deqLength :: Queue a -> Int  deterministic flexible

Returns the number of elements in the queue.


rotate :: Queue a -> Queue a  deterministic 

Moves the first element to the end of the queue.


matchHead :: Queue a -> Maybe (a,Queue a)  deterministic flexible

Matches the front of a queue. matchHead q is equivalent to if isEmpty q then Nothing else Just (deqHead q,deqTail q) but more efficient.

Further infos:
  • incompletely defined

matchLast :: Queue a -> Maybe (a,Queue a)  deterministic flexible

Matches the end of a queue. matchLast q is equivalent to if isEmpty q then Nothing else Just (deqLast q,deqInit q) but more efficient.

Further infos:
  • incompletely defined


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:27:54 2008