LanguageExt.Core

LanguageExt.Core Immutable Collections Queue

Contents

struct Que <A> Source #

Immutable queue collection

Parameters

type A

Item value type

Properties

property object? Case Source #

Reference version for use in pattern-matching

Empty collection     = null
Singleton collection = A
More                 = (A, Seq<A>)   -- head and tail

var res = list.Case switch
{

   (var x, var xs) => ...,
   A value         => ...,
   _               => ...
}

property bool IsEmpty Source #

Is the queue empty

property int Count Source #

Number of items in the queue

property int Length Source #

Alias of Count

Constructors

constructor Que (IEnumerable<A> items) Source #

Construct from a enumerable of items

Parameters

param items

Items to construct the queue from

Methods

method Que<A> Do (Action<A> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Que<A> Clear () Source #

Returns an empty queue

Parameters

returns

Empty queue

method A Peek () Source #

Look at the item at the front of the queue

Parameters

returns

The item at the front of the queue, or throw an exception if none exists

method Que<A> Dequeue () Source #

Removes the item from the front of the queue

Parameters

returns

A new Que with the first item removed

method (Que<A> Queue, A Value) DequeueUnsafe () Source #

Removes the item from the front of the queue

Parameters

returns

A tuple containing the new Que with the first item removed and the first item

method (Que<A> Queue, Option<A> Value) TryDequeue () Source #

Removes the item from the front of the queue

Parameters

returns

A tuple containing the new Que with the first item removed and optionally the first item

method Option<A> TryPeek () Source #

Look at the item at the front of the queue, if it exists.

Parameters

returns

The item at the front of the queue, if it exists. None otherwise.

method Que<A> Enqueue (A value) Source #

Add an item to the end of the queue

Parameters

param value

Value to add to the queue

returns

A new queue with the item added

method Seq<A> ToSeq () Source #

Convert to a Seq

Parameters

returns

Seq

method IEnumerable<A> AsEnumerable () Source #

Convert to an IEnumerable

Parameters

returns

IEnumerable

method IEnumerator<A> GetEnumerator () Source #

Get an enumerator of the collection

Parameters

returns

IEnumerator

method Que<A> Append (Que<A> rhs) Source #

Append two queues together

Parameters

param rhs

Second part of the queue

returns

Concatenated queue

method Que<A> Subtract (Que<A> rhs) Source #

Subtract one queue from another

Parameters

param rhs

Items to remove from the queue

returns

lhs - rhs

method int GetHashCode () Source #

Hash code of the items in the queue

Parameters

returns

Hash code

method bool Equals (object obj) Source #

Queue equality

Parameters

param obj

Value that may be a queue

returns

true if the queues are equal

method bool Equals (Que<A> other) Source #

Queue equality

Parameters

param other

Second queue

returns

true if the queues are equal

Operators

operator + (Que<A> lhs, Que<A> rhs) Source #

Append two queues together

Parameters

param lhs

First part of the queue

param rhs

Second part of the queue

returns

Concatenated queue

operator - (Que<A> lhs, Que<A> rhs) Source #

Subtract one queue from another

Parameters

param lhs

Starting queue

param rhs

Items to remove from the queue

returns

lhs - rhs

operator == (Que<A> lhs, Que<A> rhs) Source #

Queue equality

Parameters

param lhs

First queue

param rhs

Second queue

returns

true if the queues are equal

operator != (Que<A> lhs, Que<A> rhs) Source #

Queue inequality

Parameters

param lhs

First queue

param rhs

Second queue

returns

true if the queues are not-equal

class Queue Source #

Methods

method Que<T> enq <T> (Que<T> queue, T value) Source #

method (Que<T> Queue, T Value) deqUnsafe <T> (Que<T> queue) Source #

method (Que<T> Queue, Option<T> Value) deq <T> (Que<T> queue) Source #

method T peekUnsafe <T> (Que<T> queue) Source #

method Option<T> peek <T> (Que<T> queue) Source #

method Que<T> clear <T> (Que<T> queue) Source #

method Que<R> map <T, R> (Que<T> queue, Func<int, T, R> map) Source #

method Que<T> filter <T> (Que<T> queue, Func<T, bool> predicate) Source #

method Que<U> choose <T, U> (Que<T> queue, Func<T, Option<U>> selector) Source #

method Que<U> choose <T, U> (Que<T> queue, Func<int, T, Option<U>> selector) Source #

method Que<R> collect <T, R> (Que<T> queue, Func<T, IEnumerable<R>> map) Source #

method Que<T> rev <T> (Que<T> queue) Source #

method Que<T> append <T> (Que<T> lhs, IEnumerable<T> rhs) Source #

method S fold <S, T> (Que<T> queue, S state, Func<S, T, S> folder) Source #

Folds each value of the QueT into an S. wikipedia.org/wiki/Fold_(higher-order_function)

Parameters

param queue

Queue to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method S foldBack <S, T> (Que<T> queue, S state, Func<S, T, S> folder) Source #

Folds each value of the QueT into an S, but in reverse order. wikipedia.org/wiki/Fold_(higher-order_function)

Parameters

param queue

Queue to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method T reduce <T> (Que<T> queue, Func<T, T, T> reducer) Source #

method T reduceBack <T> (Que<T> queue, Func<T, T, T> reducer) Source #

method IEnumerable<S> scan <S, T> (Que<T> queue, S state, Func<S, T, S> folder) Source #

method IEnumerable<S> scanBack <S, T> (Que<T> queue, S state, Func<S, T, S> folder) Source #

method Option<T> find <T> (Que<T> queue, Func<T, bool> pred) Source #

method Que<V> zip <T, U, V> (Que<T> queue, IEnumerable<U> other, Func<T, U, V> zipper) Source #

method int length <T> (Que<T> queue) Source #

method Unit iter <T> (Que<T> queue, Action<T> action) Source #

method Unit iter <T> (Que<T> queue, Action<int, T> action) Source #

method bool forall <T> (Que<T> queue, Func<T, bool> pred) Source #

method Que<T> distinct <T> (Que<T> queue) Source #

method Que<T> distinct <EQ, T> (Que<T> queue) Source #

where EQ : struct, Eq<T>

method IEnumerable<T> take <T> (Que<T> queue, int count) Source #

method IEnumerable<T> takeWhile <T> (Que<T> queue, Func<T, bool> pred) Source #

method IEnumerable<T> takeWhile <T> (Que<T> queue, Func<T, int, bool> pred) Source #

method bool exists <T> (Que<T> queue, Func<T, bool> pred) Source #

class QueueExtensions Source #

Methods

method (Que<T>, T) PopUnsafe <T> (this Que<T> queue) Source #

method (Que<T>, Option<T>) Pop <T> (this Que<T> queue) Source #

method T PeekUnsafe <T> (this Que<T> queue) Source #

method Option<T> Peek <T> (this Que<T> queue) Source #

method Que<R> Map <T, R> (this Que<T> queue, Func<T, R> map) Source #

method Que<R> Map <T, R> (this Que<T> queue, Func<int, T, R> map) Source #

method Que<T> Filter <T> (this Que<T> queue, Func<T, bool> predicate) Source #

method Que<U> Choose <T, U> (this Que<T> queue, Func<T, Option<U>> selector) Source #

method Que<U> Choose <T, U> (this Que<T> queue, Func<int, T, Option<U>> selector) Source #

method Que<R> Collect <T, R> (this Que<T> queue, Func<T, IEnumerable<R>> map) Source #

method Que<T> Rev <T> (this Que<T> queue) Source #

method Que<T> Append <T> (this Que<T> lhs, IEnumerable<T> rhs) Source #

method S Fold <S, T> (this Que<T> queue, S state, Func<S, T, S> folder) Source #

method S FoldBack <S, T> (this Que<T> queue, S state, Func<S, T, S> folder) Source #

method T ReduceBack <T> (this Que<T> queue, Func<T, T, T> reducer) Source #

method T Reduce <T> (this Que<T> queue, Func<T, T, T> reducer) Source #

method Que<S> Scan <S, T> (this Que<T> queue, S state, Func<S, T, S> folder) Source #

method IEnumerable<S> ScanBack <S, T> (this Que<T> queue, S state, Func<S, T, S> folder) Source #

method Option<T> Find <T> (this Que<T> queue, Func<T, bool> pred) Source #

method int Length <T> (this Que<T> queue) Source #

method Unit Iter <T> (this Que<T> queue, Action<T> action) Source #

method Unit Iter <T> (this Que<T> queue, Action<int, T> action) Source #

method bool ForAll <T> (this Que<T> queue, Func<T, bool> pred) Source #

method Que<T> Distinct <T> (this Que<T> queue) Source #

method Que<T> Distinct <EQ, T> (this Que<T> list) Source #

where EQ : struct, Eq<T>

method bool Exists <T> (this Que<T> queue, Func<T, bool> pred) Source #