Deedle


Seq

This module contains additional functions for working with sequences. Deedle.Internals is opened, it extends the standard Seq module.

Functions and values

Function or valueDescription
alignWithOrdering seq1 seq2 comparer
Signature:seq1:seq<'T * 'TAddress> -> seq2:seq<'T * 'TAddress> -> comparer:IComparer<'T> -> seq<'T * 'TAddress option * 'TAddress option>
Type parameters: 'T, 'TAddress

Align two ordered sequences of Key * Address pairs and produce a collection that contains three-element tuples consisting of:

  • ordered keys (from one or the ohter sequence)
  • optional address of the key in the first sequence
  • optional address of the key in the second sequence
alignWithoutOrdering seq1 seq2
Signature:seq1:seq<'T * 'TAddress> -> seq2:seq<'T * 'TAddress> -> seq<'T * 'TAddress option * 'TAddress option>
Type parameters: 'T, 'TAddress

Align two unordered sequences of Key * Address pairs and produce a collection that contains three-element tuples consisting of keys, optional address in the first sequence & optional address in the second sequence. (See also alignWithOrdering)

chunkedUsing comparer dir keys input
Signature:comparer:Comparer<'?8044> -> dir:Direction -> keys:seq<'?8044> -> input:seq<'?8044> -> seq<'?8044 * '?8044 list>
Type parameters: '?8044

Generate non-overlapping chunks from the input sequence. Chunks are aligned to the specified keys. The dir parameter specifies the direction. If it is Direction.Forward than the key is the first element of a chunk; for Direction.Backward, the key is the last element (note that this does not hold at the boundaries)

chunkedWhile f input
Signature:f:('?8042 -> '?8042 -> bool) -> input:seq<'?8042> -> seq<'?8042 []>
Type parameters: '?8042

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.

chunkedWithBounds size boundary input
Signature:size:int -> boundary:Boundary -> input:seq<'?8048> -> seq<DataSegment<'?8048 []>>
Type parameters: '?8048

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.

getEnumerator s
Signature:s:seq<'?8036> -> IEnumerator<'?8036>
Type parameters: '?8036

Calls the GetEnumerator method. Simple function to guide type inference.

headOrNone input
Signature:input:seq<'?8032> -> '?8032 option
Type parameters: '?8032

If the input is non empty, returns Some(head) where head is the first value. Otherwise, returns None.

isSorted data comparer
Signature:data:seq<'T> -> comparer:IComparer<'T> -> bool
Type parameters: 'T

Returns true if the specified sequence is sorted.

lastFew count input
Signature:count:int -> input:seq<'?8034> -> seq<'?8034>
Type parameters: '?8034

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.

startAndEnd startCount endCount input
Signature:startCount:int -> endCount:int -> input:seq<'?8038> -> seq<Choice<'?8038,unit,'?8038>>
Type parameters: '?8038

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.

structuralEquals s1 s2
Signature:s1:seq<'T> -> s2:seq<'T> -> bool
Type parameters: 'T

Comapre two sequences using the Equals method. Returns true when all their elements are equal and they have the same size.

structuralHash s
Signature:s:seq<'T> -> int
Type parameters: 'T

Calculate hash code of a sequence, based on the values

tryFirstAndLast input
Signature:input:seq<'?8052> -> ('?8052 * '?8052) option
Type parameters: '?8052

Returns the first and the last element from a sequence or 'None' if the sequence is empty

windowedWhile f input
Signature:f:('T -> 'T -> bool) -> input:seq<'T> -> seq<'T []>
Type parameters: 'T

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.

windowedWithBounds size boundary input
Signature:size:int -> boundary:Boundary -> input:seq<'T> -> seq<DataSegment<'T []>>
Type parameters: 'T

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<T> values, which makes it easy to distinguish between complete and incomplete windows.

Fork me on GitHub