ISeq<A> Interface

Cons sequence Represents a sequence of values in a similar way to IEnumerable, but without the issues of multiple evaluation for key LINQ operators like Skip, Count, etc.

DECLARATION
public interface ISeq<A> : IEnumerable<A>,
IEquatable<ISeq<A>>,
IComparable<ISeq<A>>
NAMESPACE
LanguageExt

Properties

Count
SUMMARY

Returns the number of items in the sequence

DECLARATION
private int Count { get; }
RETURNS
int
Number of items in the sequence
Head
SUMMARY

Head of the sequence

DECLARATION
private A Head { get; }
RETURNS
A
IsEmpty
SUMMARY

True if this cons node is the Empty node

DECLARATION
private bool IsEmpty { get; }
RETURNS
bool
Tail
SUMMARY

Tail of the sequence

DECLARATION
private Seq<A> Tail { get; }
RETURNS
Seq<A>

Methods

Bind<B>(Func<A, Seq<B>>)
SUMMARY

Monadic bind (flatmap) of the sequence

PARAMETERS
f
Func<A, Seq<B>>
Bind function
DECLARATION
private Seq<B> Bind<B>(Func<A, Seq<B>> f)
RETURNS
Seq<B>
Flatmapped sequence
Exists(Func<A, bool>)
SUMMARY

Returns true if the supplied predicate returns true for any item in the sequence. False otherwise.

PARAMETERS
f
Func<A, bool>
Predicate to apply
DECLARATION
private bool Exists(Func<A, bool> f)
RETURNS
bool
True if the supplied predicate returns true for any item in the sequence. False otherwise.
Filter(Func<A, bool>)
SUMMARY

Filter the items in the sequence

PARAMETERS
f
Func<A, bool>
Predicate to apply to the items
DECLARATION
private Seq<A> Filter(Func<A, bool> f)
RETURNS
Seq<A>
Filtered sequence
Fold<S>(S, Func<S, A, S>)
SUMMARY

Fold the sequence from the first item to the last

PARAMETERS
state
S
Initial state
f
Func<S, A, S>
Fold function
DECLARATION
private S Fold<S>(S state, Func<S, A, S> f)
RETURNS
S
Aggregated state
FoldBack<S>(S, Func<S, A, S>)
SUMMARY

Fold the sequence from the last item to the first. For sequences that are not lazy and are less than 5000 items long, FoldBackRec is called instead, because it is faster.

PARAMETERS
state
S
Initial state
f
Func<S, A, S>
Fold function
DECLARATION
private S FoldBack<S>(S state, Func<S, A, S> f)
RETURNS
S
Aggregated state
FoldBackRec<S>(S, Func<S, A, S>)
SUMMARY

Fold the sequence (recursively) from the last item to the first. This is faster than FoldBack, but be wary of calling this with sequences that are large, you can blow the stack.

PARAMETERS
state
S
Initial state
f
Func<S, A, S>
Fold function
DECLARATION
private S FoldBackRec<S>(S state, Func<S, A, S> f)
RETURNS
S
Aggregated state
ForAll(Func<A, bool>)
SUMMARY

Returns true if the supplied predicate returns true for all items in the sequence. False otherwise. If there is an empty sequence then true is returned.

PARAMETERS
f
Func<A, bool>
Predicate to apply
DECLARATION
private bool ForAll(Func<A, bool> f)
RETURNS
bool
True if the supplied predicate returns true for all items in the sequence. False otherwise. If there is an empty sequence then true is returned.
HeadOrNone()
SUMMARY

Head of the sequence

DECLARATION
private Option<A> HeadOrNone()
RETURNS
Option<A>
Map<B>(Func<A, B>)
SUMMARY

Map the sequence using the function provided

PARAMETERS
f
Func<A, B>
Mapping function
DECLARATION
private Seq<B> Map<B>(Func<A, B> f)
RETURNS
Seq<B>
Mapped sequence
Match<B>(Func<B>, Func<A, Seq<A>, B>)
SUMMARY

Match empty sequence, or multi-item sequence

PARAMETERS
Empty
Func<B>
Match for an empty list
Tail
Func<A, Seq<A>, B>
Match for a non-empty
DECLARATION
private B Match<B>(Func<B> Empty, Func<A, Seq<A>, B> Tail)
RETURNS
B
Result of match function invoked
Match<B>(Func<B>, Func<A, B>, Func<A, Seq<A>, B>)
SUMMARY

Match empty sequence, or one item sequence, or multi-item sequence

PARAMETERS
Empty
Func<B>
Match for an empty list
Head
Func<A, B>
Tail
Func<A, Seq<A>, B>
Match for a non-empty
DECLARATION
private B Match<B>(Func<B> Empty, Func<A, B> Head, Func<A, Seq<A>, B> Tail)
RETURNS
B
Result of match function invoked
Match<B>(Func<B>, Func<Seq<A>, B>)
SUMMARY

Match empty sequence, or multi-item sequence

PARAMETERS
Empty
Func<B>
Match for an empty list
Seq
Func<Seq<A>, B>
Match for a non-empty
DECLARATION
private B Match<B>(Func<B> Empty, Func<Seq<A>, B> Seq)
RETURNS
B
Result of match function invoked
Match<B>(Func<B>, Func<A, B>, Func<Seq<A>, B>)
SUMMARY

Match empty sequence, or one item sequence, or multi-item sequence

PARAMETERS
Empty
Func<B>
Match for an empty list
Head
Func<A, B>
Tail
Func<Seq<A>, B>
Match for a non-empty
DECLARATION
private B Match<B>(Func<B> Empty, Func<A, B> Head, Func<Seq<A>, B> Tail)
RETURNS
B
Result of match function invoked
Select<B>(Func<A, B>)
SUMMARY

Map the sequence using the function provided

PARAMETERS
f
Func<A, B>
Mapping function
DECLARATION
private Seq<B> Select<B>(Func<A, B> f)
RETURNS
Seq<B>
Mapped sequence
SelectMany<B, C>(Func<A, Seq<B>>, Func<A, B, C>)
SUMMARY

Monadic bind (flatmap) of the sequence

PARAMETERS
bind
Func<A, Seq<B>>
Bind function
project
Func<A, B, C>
DECLARATION
private Seq<C> SelectMany<B, C>(Func<A, Seq<B>> bind, Func<A, B, C> project)
RETURNS
Seq<C>
Flatmapped sequence
Skip(int)
SUMMARY

Skip count items

PARAMETERS
count
int
DECLARATION
private Seq<A> Skip(int count)
RETURNS
Seq<A>
Take(int)
SUMMARY

Take count items

PARAMETERS
count
int
DECLARATION
private Seq<A> Take(int count)
RETURNS
Seq<A>
TakeWhile(Func<A, bool>)
SUMMARY

Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't

PARAMETERS
pred
Func<A, bool>
DECLARATION
private Seq<A> TakeWhile(Func<A, bool> pred)
RETURNS
Seq<A>
A new sequence with the first items that match the predicate
TakeWhile(Func<A, int, bool>)
SUMMARY

Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't. An index value is also provided to the predicate function.

PARAMETERS
pred
Func<A, int, bool>
DECLARATION
private Seq<A> TakeWhile(Func<A, int, bool> pred)
RETURNS
Seq<A>
A new sequence with the first items that match the predicate
Where(Func<A, bool>)
SUMMARY

Filter the items in the sequence

PARAMETERS
f
Func<A, bool>
Predicate to apply to the items
DECLARATION
private Seq<A> Where(Func<A, bool> f)
RETURNS
Seq<A>
Filtered sequence