Represents an immutable lazy sequence of elements.
Elements are only evaluated when they're needed, and ISequence T employs memoization to store the computed values and avoid re-evaluation.
Namespace: SequencesAssembly: Sequences (in Sequences.dll) Version: 1.0.1.0 (1.0.1)
Syntax
Type Parameters
- T
- The type of elements in the sequence.
The ISequence T type exposes the following members.
Methods
Name | Description | |
---|---|---|
Append |
Returns a copy of this sequence with the given element appended.
| |
Combinations |
Iterate over distinct combinations of a given size of this sequence's elements.
| |
Concat |
Returns a copy of this sequence concatenated with otherSequence.
| |
ContainsSlice |
Tests whether this sequence contains a given sequence as a slice.
If this sequence represents an infinite set or series and doesn't contain slice, this will never return!
| |
CopyTo( T ) |
Copies the entire sequence to an array, starting at the beginning of the target array.
Copying will stop once either the end of this sequence is reached, or the end of the array is reached.
| |
CopyTo( T , Int32) |
Copies the entire sequence to an array, starting at the position destinationIndex of the target array.
Copying will stop once either the end of this sequence is reached, or the end of the array is reached.
| |
CopyTo(Int32, T , Int32, Int32) |
Copies a given number of elements from this sequence to an array, starting at the position index of this sequence
and at the position destinationIndex of the target array.
Copying will stop once either the end of this sequence is reached, or the end of the array is reached, or count elements have been copied.
| |
Fold |
Folds the elements of this sequence using the specified accumulator function.
If this sequence represents an infinite set or series, this will never return!
| |
FoldRight |
Folds the elements of this sequence using the specified accumulator function, going right to left.
If this sequence represents an infinite set or series, this will never return!
| |
Force |
Forces evaluation of the whole sequence and returns it.
If this sequence represents an infinite set or series, the method will never return!
| |
ForEach |
Apply the given function to each element of this sequence.
If this sequence represents an infinite set or series, this will never return!
| |
GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from IEnumerable T .) | |
GetEnumerator | Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.) | |
Grouped |
Partitions elements in fixed size sequences.
| |
IndexOf(T) |
Finds the index of the first occurrence of some value in this sequence.
If this sequence represents an infinite set or series and doesn't contain elem, this will never return!
| |
IndexOf(T, Int32) |
Finds the index of the first occurrence of some value in this sequence, after or at some start index.
If this sequence represents an infinite set or series and doesn't contain elem, this will never return!
| |
IndexOf(T, Int32, Int32) |
Finds the index of the first occurrence of some value in this sequence, after or at some start index and within the range specified by count.
| |
IndexOfSlice(IEnumerable T ) |
Finds the index of the first occurrence of a given sequence as a slice.
If this sequence represents an infinite set or series and doesn't contain slice, this will never return!
| |
IndexOfSlice(IEnumerable T , Int32) |
Finds the index after or at a given start index of the first occurrence of a given sequence as a slice.
If this sequence represents an infinite set or series and doesn't contain slice, this will never return!
| |
IndexWhere(Func T, Boolean ) |
Finds the index of the first element satisfying some predicate.
If this sequence represents an infinite set or series and no element satisfies the predicate, this will never return!
| |
IndexWhere(Func T, Boolean , Int32) |
Finds the index of the first element satisfying some predicate after or at some start index.
If this sequence represents an infinite set or series and no element satisfies the predicate, this will never return!
| |
IndexWhere(Func T, Boolean , Int32, Int32) |
Finds the index of the first element satisfying some predicate after or at some start index and within the range specified by count.
| |
Indices |
Produces the range of all indices of this sequence.
| |
Inits |
Iterates over the inits of this sequence. The first value will be this sequence, and the last value will be an empty sequence,
with the intervening values the results of successive applications of Init.
| |
LastIndexOf(T) |
Finds the index of the last occurrence of some value in this sequence.
If this sequence represents an infinite set or series, this will never return!
| |
LastIndexOf(T, Int32) |
Finds the index of the last occurrence of some value in this sequence, before or at some end index.
If this sequence represents an infinite set or series, this will never return!
| |
LastIndexOf(T, Int32, Int32) |
Finds the index of the last occurrence of some value in this sequence, before or at some end index and within the range specified by count.
If this sequence represents an infinite set or series, this will never return!
| |
LastIndexWhere(Func T, Boolean ) |
Finds the index of the last element satisfying some predicate.
If this sequence represents an infinite set or series, this will never return!
| |
LastIndexWhere(Func T, Boolean , Int32) |
Finds the index of the last element satisfying some predicate before or at some end index.
If this sequence represents an infinite set or series, this will never return!
| |
LastIndexWhere(Func T, Boolean , Int32, Int32) |
Finds the index of the last element satisfying some predicate before or at some end index and within the range specified by count.
If this sequence represents an infinite set or series, this will never return!
| |
LengthCompare |
Compares the length of this sequence with a test value.
This method does not call Count directly - its running time is O(count min length) instead of O(count).
| |
MkString |
Returns a string with all the elements of this sequence.
If this sequence represents an infinite set or series, this will never return!
| |
MkString(String) |
Returns a string with all the elements of this sequence, using a seperator string.
If this sequence represents an infinite set or series, this will never return!
| |
NonEmptyTails |
Iterates over the tails of this sequence. The first value will be this sequence, and the last value will be a sequence with the last element of this sequence,
with the intervening values the results of successive applications of Tail.
| |
PadTo |
Returns a new sequence in which the end is padded with elem, if this sequence has less elements than length.
| |
Partition |
Returns a pair of sequences, where the first contains all the elements of this sequence that satisfy the predicate function,
and the second contains the elements that don't.
| |
Patch |
Returns a copy of this sequence where a slice of its elements is replaced by a patch sequence.
| |
Permutations |
Iterates over distinct permutations of this sequence.
If this sequence represents an infinite set or series, calling GetEnumerator on the result value will not return!
| |
Prepend |
Returns a copy of this sequence with the given element prepended.
| |
Reduce |
Reduces the elements of this sequence using the specified function.
If this sequence represents an infinite set or series, this will never return!
| |
ReduceRight |
Reduces the elements of this sequence using the specified function, going right to left.
If this sequence represents an infinite set or series, this will never return!
| |
Remove |
Returns a copy of this sequence without the first occurrence of the given element, if any is found.
| |
Scan |
Crates a new sequence which contains all intermediate results of successive applications of a function op to subsequent elements left to right.
| |
ScanRight |
Crates a new sequence which contains all intermediate results of successive applications of a function op to subsequent elements right to left.
If this sequence represents an infinite set or series, this will never return!
| |
Slice |
Returns a subsequence starting at index from and extending up to (but not including) index until.
| |
Sliding(Int32) |
Groups elements in fixed size blocks by passing a "sliding window" over them.
| |
Sliding(Int32, Int32) |
Groups elements in fixed size blocks by passing a "sliding window" over them.
| |
Span |
Splits this sequence into a prefix/suffix pair according to a predicate.
The first sequence will contain the longest prefix of this sequence whose elements all satisfy predicate.
| |
SplitAt |
Splits this sequence into two at a given position.
| |
Tails |
Iterates over the tails of this sequence. The first value will be this sequence, and the last value will be an empty sequence,
with the intervening values the results of successive applications of Tail.
| |
Updated |
Returns a copy of this sequence with one single replaced element.
If index is greater than the number of elements in this sequence, nothing will be replaced.
| |
Zip TSecond |
Returns a sequence of tuples, where each tuple is formed by associating an element of this sequence with the element at the same position in the second sequence.
If one of the two sequences is longer than the other, its remaining elements are ignored.
| |
ZipAll TSecond |
Returns a sequence of tuples, where each tuple is formed by associating an element of this sequence with the element at the same position in the second sequence.
If one of the two sequences is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the other.
| |
ZipWithIndex |
Returns a sequence of tuples, where each tuple is formed by associating an element of this sequence with its index.
|
Extension Methods
Name | Description | |
---|---|---|
AsSequence T |
Creates a sequence from a given enumerable.
(Defined by Sequence.) | |
Distinct TSource | Overloaded.
Returns distinct elements from a sequence by using the default equality comparer to compare values.
(Defined by Sequence.) | |
Distinct TSource (IEqualityComparer TSource ) | Overloaded.
Returns distinct elements from a sequence by using a specified IEqualityComparer T to compare values.
(Defined by Sequence.) | |
Except TSource (IEnumerable TSource ) | Overloaded.
Produces the set difference of two sequences by using the default equality comparer to compare values.
If the second sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Except TSource (IEnumerable TSource , IEqualityComparer TSource ) | Overloaded.
Produces the set difference of two sequences by using the specified IEqualityComparer T to compare values.
If the second sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Intersect TSource (IEnumerable TSource ) | Overloaded.
Produces the set intersection of two sequences by using the default equality comparer to compare values.
If the second sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Intersect TSource (IEnumerable TSource , IEqualityComparer TSource ) | Overloaded.
Produces the set intersection of two sequences by using the specified IEqualityComparer T to compare values.
If the second sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Reverse TSource |
Inverts the order of the elements in a sequence.
If the source sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Select TSource, TResult (Func TSource, TResult ) | Overloaded.
Projects each element of a sequence into a new sequence.
(Defined by Sequence.) | |
Select TSource, TResult (Func TSource, Int32, TResult ) | Overloaded.
Projects each element of a sequence into a new sequence.
Each element's index is used in the logic of the selector function.
(Defined by Sequence.) | |
SelectMany TSource, TResult (Func TSource, IEnumerable TResult ) | Overloaded.
Projects each element of a sequence to an IEnumerable T and flattens the resulting enumerables into one sequence.
(Defined by Sequence.) | |
SelectMany TSource, TResult (Func TSource, Int32, IEnumerable TResult ) | Overloaded.
Projects each element of a sequence to an IEnumerable T and flattens the resulting enumerables into one sequence.
The index of each source element is used in the projected form of that element.
(Defined by Sequence.) | |
SelectMany TSource, TCollection, TResult (Func TSource, IEnumerable TCollection , Func TSource, TCollection, TResult ) | Overloaded.
Projects each element of a sequence to an IEnumerable T , flattens the resulting enumerables into one sequence, and invokes a result selector function on each element therein.
(Defined by Sequence.) | |
SelectMany TSource, TCollection, TResult (Func TSource, Int32, IEnumerable TCollection , Func TSource, TCollection, TResult ) | Overloaded.
Projects each element of a sequence to an IEnumerable T , flattens the resulting enumerables into one sequence, and invokes a result selector function on each element therein.
The index of each source element is used in the intermediate projected form of that element.
(Defined by Sequence.) | |
Skip TSource |
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
(Defined by Sequence.) | |
SkipWhile TSource (Func TSource, Boolean ) | Overloaded.
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
If the source sequence represents an infinite set or series and all elements satisfy the given condition, this will never return!
(Defined by Sequence.) | |
SkipWhile TSource (Func TSource, Int32, Boolean ) | Overloaded.
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
The element's index is used in the logic of the predicate function.
If the source sequence represents an infinite set or series and all elements satisfy the given condition, this will never return!
(Defined by Sequence.) | |
Sum TSource (Func TSource, BigInteger ) | Overloaded.
Computes the sum of the sequence of BigInteger values that are obtained by invoking a transform function on each element of the input sequence.
If the source sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Sum TSource (Func TSource, Nullable BigInteger ) | Overloaded.
Computes the sum of the sequence of Nullable T values that are obtained by invoking a transform function on each element of the input sequence.
If the source sequence represents an infinite set or series, this will never return!
(Defined by Sequence.) | |
Take TSource |
Returns a specified number of contiguous elements from the start of a sequence.
(Defined by Sequence.) | |
TakeWhile TSource (Func TSource, Boolean ) | Overloaded.
Returns elements from a sequence as long as a specified condition is true.
(Defined by Sequence.) | |
TakeWhile TSource (Func TSource, Int32, Boolean ) | Overloaded.
Returns elements from a sequence as long as a specified condition is true.
The element's index is used in the logic of the predicate function.
(Defined by Sequence.) | |
Union TSource (IEnumerable TSource ) | Overloaded.
Produces the set union of two sequences by using the default equality comparer.
(Defined by Sequence.) | |
Union TSource (IEnumerable TSource , IEqualityComparer TSource ) | Overloaded.
Produces the set union of two sequences by using a specified IEqualityComparer T .
(Defined by Sequence.) | |
Where TSource (Func TSource, Boolean ) | Overloaded.
Filters a sequence of values based on a predicate.
(Defined by Sequence.) | |
Where TSource (Func TSource, Int32, Boolean ) | Overloaded.
Filters a sequence of values based on a predicate.
Each element's index is used in the logic of the predicate function.
(Defined by Sequence.) | |
Zip TFirst, TSecond, TResult |
Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
(Defined by Sequence.) |
Properties
Name | Description | |
---|---|---|
Count |
Returns the length of this sequence.
If this sequence represents an infinite set or series, this will never return!
| |
HasDefiniteSize |
Tests whether this sequence is known to have a finite size.
| |
Head |
Returns the first element of this sequence.
| |
Init |
Returns this sequence without its last element.
| |
IsEmpty |
Tests whether the sequence is empty.
| |
IsTailDefined |
Checks whether this sequence's tail has been evaluated.
| |
Item |
Gets the element at the specified index.
| |
NonEmpty |
Tests whether the sequence is not empty.
| |
Tail |
Returns a sequence of all elements except the first.
|
See Also