C# Class clojure.lang.PersistentQueue

A persistent queue. (Conses onto rear, peeks/pops from front.)

See Okasaki's Batched Queues.

This differs in that it uses an IPersistentList as the rear, which is in-order, so no reversing or suspensions required for persistent use.

Inheritance: clojure.lang.Obj, IPersistentList, ICollection
Datei anzeigen Open project: arohner/clojure-contrib

Public Properties

Property Type Description
EMPTY PersistentQueue

Protected Properties

Property Type Description
_f ISeq
_hash int
_r IPersistentVector

Public Methods

Method Description
CopyTo ( Array array, int index ) : void
Equals ( object obj ) : bool

Determines if an object is equal to the current object.

GetEnumerator ( ) : IEnumerator
GetHashCode ( ) : int

Get the hash code for the current object.

Result is cached.

cons ( object o ) : IPersistentCollection

Returns a new collection that has the given element cons'd on front of the existing collection.

count ( ) : int

Gets the number of items in the collection.

empty ( ) : IPersistentCollection
equiv ( object o ) : bool
peek ( ) : object

Peek at the top (first) element in the stack.

pop ( ) : IPersistentStack

Returns a new stack with the top element popped.

seq ( ) : ISeq

Gets an ISeq to allow first/rest iteration through the collection.

withMeta ( IPersistentMap meta ) : IObj

Create a copy with new metadata.

Protected Methods

Method Description
PersistentQueue ( IPersistentMap meta, ISeq f, IPersistentVector r ) : System

Inititalizes a PersistentQueue from given metadata, front, rear.

Method Details

CopyTo() public method

public CopyTo ( Array array, int index ) : void
array System.Array
index int
return void

Equals() public method

Determines if an object is equal to the current object.
public Equals ( object obj ) : bool
obj object The object to compare to.
return bool

GetEnumerator() public method

public GetEnumerator ( ) : IEnumerator
return IEnumerator

GetHashCode() public method

Get the hash code for the current object.
Result is cached.
public GetHashCode ( ) : int
return int

PersistentQueue() protected method

Inititalizes a PersistentQueue from given metadata, front, rear.
protected PersistentQueue ( IPersistentMap meta, ISeq f, IPersistentVector r ) : System
meta IPersistentMap
f ISeq
r IPersistentVector
return System

cons() public method

Returns a new collection that has the given element cons'd on front of the existing collection.
public cons ( object o ) : IPersistentCollection
o object An item to put at the front of the collection.
return IPersistentCollection

count() public method

Gets the number of items in the collection.
public count ( ) : int
return int

empty() public method

public empty ( ) : IPersistentCollection
return IPersistentCollection

equiv() public method

public equiv ( object o ) : bool
o object
return bool

peek() public method

Peek at the top (first) element in the stack.
public peek ( ) : object
return object

pop() public method

Returns a new stack with the top element popped.
public pop ( ) : IPersistentStack
return IPersistentStack

seq() public method

Gets an ISeq to allow first/rest iteration through the collection.
public seq ( ) : ISeq
return ISeq

withMeta() public method

Create a copy with new metadata.
public withMeta ( IPersistentMap meta ) : IObj
meta IPersistentMap The new metadata.
return IObj

Property Details

EMPTY public_oe static_oe property

An empty PersistentQueue.
public static PersistentQueue,clojure.lang EMPTY
return PersistentQueue

_f protected_oe property

The front elements of the queue.
protected ISeq _f
return ISeq

_hash protected_oe property

Cached hash code.
protected int _hash
return int

_r protected_oe property

The rear elements of the queue.
protected IPersistentVector _r
return IPersistentVector