Seq Module
This module contains additional functions for working with sequences. `Deedle.Internals` is opened, it extends the standard `Seq` module.
Functions and values
| Function or value |
Description
|
Full Usage:
alignAllOrdered collections comparer
Parameters:
ReadOnlyCollection<'a>[]
comparer : IComparer<'a>
Returns: 'a[] * (int64 * int64)[] list
|
Calls either `alignAllOrderedMany` or `alignAllOrderedFew` depending on the number of sequences to be aligned. Performance measurements suggest that 150 is the limit when the implementation using binomial heap is faster.
|
Full Usage:
alignAllOrderedFew seqs comparer
Parameters:
ReadOnlyCollection<'T>[]
comparer : IComparer<'T>
Returns: 'T[] * (int64 * int64)[] list
|
Align N ordered sequences of keys (using the specified comparer) This is the same as `alignOrdered` but for larger number of key sequences. Throws ComparisonFailedException when the comparer fails. (This performs union on the specified sequences)
|
Full Usage:
alignAllOrderedMany seqs comparer
Parameters:
ReadOnlyCollection<'T>[]
comparer : IComparer<'T>
Returns: 'T[] * (int64 * int64)[] list
|
Align N ordered sequences of keys (using the specified comparer) This is the same as `alignOrdered` but for larger number of key sequences. Throws ComparisonFailedException when the comparer fails. (This performs union on the specified sequences)
|
Full Usage:
alignAllUnordered seqs
Parameters:
ReadOnlyCollection<'T>[]
Returns: 'T[] * (int64 * int64)[] list
|
Align N unordered sequences of keys (performs union of the keys)
|
Full Usage:
alignOrdered seq1 seq2 comparer intersectionOnly
Parameters:
ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
comparer : IComparer<'T>
intersectionOnly : bool
Returns: 'T[] * (int64 * int64)[] list
|
Align two ordered sequences of keys (using the specified comparer) The resulting relocations are returned as two-element list for symmetry with other functions Throws ComparisonFailedException when the comparer fails. When `intersectionOnly = true`, the function only adds keys & relocations for keys that appear in both sequences (otherwise, it performs union)
|
Full Usage:
alignUnordered s1 s2 intersectionOnly
Parameters:
ReadOnlyCollection<'a>
s2 : ReadOnlyCollection<'a>
intersectionOnly : bool
Returns: 'a[] * (int64 * int64)[] list
|
Align two unordered sequences of keys. Calls either `alignUnorderedUnion` or `alignUnorderedIntersection`, based on the `intersectionOnly` parameter.
|
Full Usage:
alignUnorderedIntersection seq1 seq2
Parameters:
ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
Returns: 'T[] * (int64 * int64)[] list
|
Align two unordered sequences of keys (performs intersection of the keys) The resulting relocations are returned as two-element list for symmetry with other functions
|
Full Usage:
alignUnorderedUnion seq1 seq2
Parameters:
ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
Returns: 'T[] * (int64 * int64)[] list
|
Align two unordered sequences of keys (performs union of the keys) The resulting relocations are returned as two-element list for symmetry with other functions
|
Full Usage:
choosel f input
Parameters:
int64 -> 'a -> 'b option
input : 'a seq
Returns: 'b seq
Modifiers: inline Type parameters: 'a, 'b |
Same as `Seq.choose` but passes 64 bit index (l stands for long) to the function
|
Full Usage:
chunkRangesWhile f input
Parameters:
'a -> 'a -> bool
input : 'a seq
Returns: (int64 * int64) seq
|
Generate non-verlapping chunks from the input sequence. A chunk is started at the beginning and then immediately after the end of the previous chunk. To find the end of the chunk, the function calls the provided argument `f` with the first and the last elements of the chunk as arguments. A chunk ends when `f` returns `false`. The function returns the chunks as pairs of their indices.
|
Full Usage:
chunkRangesWithBounds size boundary length
Parameters:
int64
boundary : Boundary
length : int64
Returns: (DataSegmentKind * int64 * int64) seq
|
Generates addresses of windows in a collection of size 'length'. For example, consider
a collection with 7 elements (and indices 0 .. 6) and the requirement to create windows
of length 3:
0 1 2 3 4 5 6
When the `AtEnding` flag is set for `boundary`:
c c c
c c c
d
The two chunks marked as 'c' are returned always. The incomplete chunk at the end is
returned unless the `Skip` flag is set for `boundary`. When the `AtBeginning` flag is
set, the incomplete chunk is (when not `Skip`) returned at the beginning:
d
c c c
c c c
The chunks are specified by *inclusive* indices, so, e.g. the first chunk in
the second example above is returned as a pair (0, 0).
|
Full Usage:
chunkedWhile f input
Parameters:
'a -> 'a -> bool
input : 'a seq
Returns: 'a array seq
|
Generate non-verlapping chunks from the input sequence. A chunk is started at the beginning and then immediately after the end of the previous chunk. To find the end of the chunk, the function calls the provided argument `f` with the first and the last elements of the chunk as arguments. A chunk ends when `f` returns `false`.
|
Full Usage:
chunkedWithBounds size boundary input
Parameters:
int
boundary : Boundary
input : 'a seq
Returns: DataSegment<'a array> seq
|
Similar to `Seq.windowedWithBounds`, but generates non-overlapping chunks rather than floating windows. See that function for detailed documentation. The function may iterate over the sequence repeatedly.
|
|
Calls the `GetEnumerator` method. Simple function to guide type inference.
|
Full Usage:
headOrNone input
Parameters:
'a seq
Returns: 'a option
|
If the input is non empty, returns `Some(head)` where `head` is the first value. Otherwise, returns `None`.
|
|
Returns true if the specified sequence is sorted.
|
Full Usage:
lastAndLength input
Parameters:
'a seq
Returns: 'a * int
Modifiers: inline Type parameters: 'a |
Returns the last element and the length of a sequence (using just a single iteration over the sequence)
|
Full Usage:
lastFew count input
Parameters:
int
input : 'a seq
Returns: 'a seq
|
Returns the specified number of elements from the end of the sequence Note that this needs to store the specified number of elements in memory and it needs to iterate over the entire sequence.
|
Full Usage:
mapl f input
Parameters:
int64 -> 'a -> 'b
input : 'a seq
Returns: 'b seq
Modifiers: inline Type parameters: 'a, 'b |
Same as `Seq.map` but passes 64 bit index (l stands for long) to the function
|
Full Usage:
range lo hi
Parameters:
^T
hi : ^T
Returns: IEnumerable<^T>
Modifiers: inline Type parameters: ^T |
A helper function that generates a sequence for the specified range of int or int64 values. This is notably faster than using `lo .. hi`.
|
Full Usage:
rangeStep lo step hi
Parameters:
^T
step : ^T
hi : ^T
Returns: IEnumerable<^T>
Modifiers: inline Type parameters: ^T |
A helper function that generates a sequence for the specified range of int or int64 values. This is notably faster than using `lo .. step .. hi`.
|
Full Usage:
skipAtMost count input
Parameters:
int
input : 'a seq
Returns: 'a seq
|
Skip at most the specified number of elements. This is like `Seq.skip`, but it does not throw when the sequence is shorter.
|
Full Usage:
startAndEnd startCount endCount input
Parameters:
int
endCount : int
input : 'a seq
Returns: Choice<'a, unit, 'a> seq
|
Given a sequence, returns `startCount` number of elements at the beginning of the sequence (wrapped in `Choice1Of3`) followed by one `Choice2Of2()` value and then followed by `endCount` number of elements at the end of the sequence wrapped in `Choice3Of3`. If the input is shorter than `startCount + endCount`, then all values are returned and wrapped in `Choice1Of3`.
|
Full Usage:
structuralEquals s1 s2
Parameters:
'T seq
s2 : 'T seq
Returns: bool
|
Comapre two sequences using the `Equals` method. Returns true when all their elements are equal and they have the same size.
|
Full Usage:
structuralHash s
Parameters:
'T seq
Returns: int
|
Calculate hash code of a sequence, based on the values
|
Full Usage:
tryFirstAndLast input
Parameters:
'a seq
Returns: ('a * 'a) option
|
Returns the first and the last element from a sequence or 'None' if the sequence is empty
|
Full Usage:
uniqueBy f input
Parameters:
'a -> 'b
input : 'a seq
Returns: 'b
|
If the projection returns the same value for all elements, then it returns the value. Otherwise it throws an exception.
|
Full Usage:
unreduce f start
Parameters:
'a -> 'a
start : 'a
Returns: 'a seq
Modifiers: inline Type parameters: 'a |
Generate infinite sequence using the specified function. The initial state is returned as the first element.
|
Full Usage:
windowRangesWhile f input
Parameters:
'T -> 'T -> bool
input : 'T seq
Returns: (int64 * int64) seq
|
Generate floating windows from the input sequence. New floating window is started for each element. To find the end of the window, the function calls the provided argument `f` with the first and the last elements of the window as arguments. A window ends when `f` returns `false`. The function returns the windows as pairs of their indices.
|
Full Usage:
windowRangesWhileFromEnd f input
Parameters:
'T -> 'T -> bool
input : 'T seq
Returns: (int64 * int64) seq
|
Generate overlapping floating windows from the input sequence. A window ends at each element of the input. To find the start of the window, the function walks backward from the current element and calls the provided argument `f` with the candidate start element and the current (end) element. The window starts at the earliest element for which `f` returns `true`. The function returns the windows as pairs of their (start, end) indices.
|
Full Usage:
windowRangesWithBounds size boundary length
Parameters:
int64
boundary : Boundary
length : int64
Returns: (DataSegmentKind * int64 * int64) seq
|
Generates addresses of chunks in a collection of size 'length'. For example, consider
a collection with 7 elements (and indices 0 .. 6) and the requirement to create chunks
of length 4:
0 1 2 3 4 5 6
s
s s
s s s
w w w w
w w w w
w w w w
w w w w
e e e
e e
e
The windows 's' are returned when `boundary = Boundary.AtBeginning` and the windows
'e' are returned when `boundary = Boundary.AtEnding`. The middle is returned always.
The windows are specified by *inclusive* indices, so, e.g. the first window is returned
as a pair (0, 0).
|
Full Usage:
windowedWhile f input
Parameters:
'T -> 'T -> bool
input : 'T seq
Returns: 'T array seq
|
Generate floating windows from the input sequence. New floating window is started for each element. To find the end of the window, the function calls the provided argument `f` with the first and the last elements of the window as arguments. A window ends when `f` returns `false`.
|
Full Usage:
windowedWithBounds size boundary input
Parameters:
int
boundary : Boundary
input : 'T seq
Returns: DataSegment<'T array> seq
|
A version of `Seq.windowed` that allows specifying more complex boundary
behaviour. The `boundary` argument can specify one of the following options:
* `Boundary.Skip` - only full windows are returned (like `Seq.windowed`)
* `Boundary.AtBeginning` - incomplete windows (smaller than the required
size) are returned at the beginning.
* `Boundary.AtEnding` - incomplete windows are returned at the end.
The result is a sequence of `DataSegnebt
|
Deedle