Header menu logo Deedle

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

alignAllOrdered collections comparer

Full Usage: alignAllOrdered collections comparer

Parameters:
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.

collections : ReadOnlyCollection<'a>[]
comparer : IComparer<'a>
Returns: 'a[] * (int64 * int64)[] list

alignAllOrderedFew seqs comparer

Full Usage: alignAllOrderedFew seqs comparer

Parameters:
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)

seqs : ReadOnlyCollection<'T>[]
comparer : IComparer<'T>
Returns: 'T[] * (int64 * int64)[] list

alignAllOrderedMany seqs comparer

Full Usage: alignAllOrderedMany seqs comparer

Parameters:
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)

seqs : ReadOnlyCollection<'T>[]
comparer : IComparer<'T>
Returns: 'T[] * (int64 * int64)[] list

alignAllUnordered seqs

Full Usage: alignAllUnordered seqs

Parameters:
Returns: 'T[] * (int64 * int64)[] list

Align N unordered sequences of keys (performs union of the keys)

seqs : ReadOnlyCollection<'T>[]
Returns: 'T[] * (int64 * int64)[] list

alignOrdered seq1 seq2 comparer intersectionOnly

Full Usage: alignOrdered seq1 seq2 comparer intersectionOnly

Parameters:
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)

seq1 : ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
comparer : IComparer<'T>
intersectionOnly : bool
Returns: 'T[] * (int64 * int64)[] list

alignUnordered s1 s2 intersectionOnly

Full Usage: alignUnordered s1 s2 intersectionOnly

Parameters:
Returns: 'a[] * (int64 * int64)[] list

Align two unordered sequences of keys. Calls either `alignUnorderedUnion` or `alignUnorderedIntersection`, based on the `intersectionOnly` parameter.

s1 : ReadOnlyCollection<'a>
s2 : ReadOnlyCollection<'a>
intersectionOnly : bool
Returns: 'a[] * (int64 * int64)[] list

alignUnorderedIntersection seq1 seq2

Full Usage: alignUnorderedIntersection seq1 seq2

Parameters:
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

seq1 : ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
Returns: 'T[] * (int64 * int64)[] list

alignUnorderedUnion seq1 seq2

Full Usage: alignUnorderedUnion seq1 seq2

Parameters:
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

seq1 : ReadOnlyCollection<'T>
seq2 : ReadOnlyCollection<'T>
Returns: 'T[] * (int64 * int64)[] list

choosel f input

Full Usage: choosel f input

Parameters:
    f : 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

f : int64 -> 'a -> 'b option
input : 'a seq
Returns: 'b seq

chunkRangesWhile f input

Full Usage: chunkRangesWhile f input

Parameters:
    f : '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.

f : 'a -> 'a -> bool
input : 'a seq
Returns: (int64 * int64) seq

chunkRangesWithBounds size boundary length

Full Usage: chunkRangesWithBounds size boundary length

Parameters:
    size : 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).
size : int64
boundary : Boundary
length : int64
Returns: (DataSegmentKind * int64 * int64) seq

chunkedWhile f input

Full Usage: chunkedWhile f input

Parameters:
    f : '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`.

f : 'a -> 'a -> bool
input : 'a seq
Returns: 'a array seq

chunkedWithBounds size boundary input

Full Usage: chunkedWithBounds size boundary input

Parameters:
    size : 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.

size : int
boundary : Boundary
input : 'a seq
Returns: DataSegment<'a array> seq

getEnumerator s

Full Usage: getEnumerator s

Parameters:
    s : 'a seq

Returns: IEnumerator<'a>

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

s : 'a seq
Returns: IEnumerator<'a>

headOrNone input

Full Usage: headOrNone input

Parameters:
    input : 'a seq

Returns: 'a option

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

input : 'a seq
Returns: 'a option

isSorted data comparer

Full Usage: isSorted data comparer

Parameters:
Returns: bool

Returns true if the specified sequence is sorted.

data : 'T seq
comparer : IComparer<'T>
Returns: bool

lastAndLength input

Full Usage: lastAndLength input

Parameters:
    input : '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)

input : 'a seq
Returns: 'a * int

lastFew count input

Full Usage: lastFew count input

Parameters:
    count : 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.

count : int
input : 'a seq
Returns: 'a seq

mapl f input

Full Usage: mapl f input

Parameters:
    f : 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

f : int64 -> 'a -> 'b
input : 'a seq
Returns: 'b seq

range lo hi

Full Usage: range lo hi

Parameters:
    lo : ^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`.

lo : ^T
hi : ^T
Returns: IEnumerable<^T>

rangeStep lo step hi

Full Usage: rangeStep lo step hi

Parameters:
    lo : ^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`.

lo : ^T
step : ^T
hi : ^T
Returns: IEnumerable<^T>

skipAtMost count input

Full Usage: skipAtMost count input

Parameters:
    count : 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.

count : int
input : 'a seq
Returns: 'a seq

startAndEnd startCount endCount input

Full Usage: startAndEnd startCount endCount input

Parameters:
    startCount : 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`.

startCount : int
endCount : int
input : 'a seq
Returns: Choice<'a, unit, 'a> seq

structuralEquals s1 s2

Full Usage: structuralEquals s1 s2

Parameters:
    s1 : '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.

s1 : 'T seq
s2 : 'T seq
Returns: bool

structuralHash s

Full Usage: structuralHash s

Parameters:
    s : 'T seq

Returns: int

Calculate hash code of a sequence, based on the values

s : 'T seq
Returns: int

tryFirstAndLast input

Full Usage: tryFirstAndLast input

Parameters:
    input : 'a seq

Returns: ('a * 'a) option

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

input : 'a seq
Returns: ('a * 'a) option

uniqueBy f input

Full Usage: uniqueBy f input

Parameters:
    f : '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.

f : 'a -> 'b
input : 'a seq
Returns: 'b

unreduce f start

Full Usage: unreduce f start

Parameters:
    f : '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.

f : 'a -> 'a
start : 'a
Returns: 'a seq

windowRangesWhile f input

Full Usage: windowRangesWhile f input

Parameters:
    f : '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.

f : 'T -> 'T -> bool
input : 'T seq
Returns: (int64 * int64) seq

windowRangesWhileFromEnd f input

Full Usage: windowRangesWhileFromEnd f input

Parameters:
    f : '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.

f : 'T -> 'T -> bool
input : 'T seq
Returns: (int64 * int64) seq

windowRangesWithBounds size boundary length

Full Usage: windowRangesWithBounds size boundary length

Parameters:
    size : 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).
size : int64
boundary : Boundary
length : int64
Returns: (DataSegmentKind * int64 * int64) seq

windowedWhile f input

Full Usage: windowedWhile f input

Parameters:
    f : '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`.

f : 'T -> 'T -> bool
input : 'T seq
Returns: 'T array seq

windowedWithBounds size boundary input

Full Usage: windowedWithBounds size boundary input

Parameters:
    size : 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` values, which makes it
 easy to distinguish between complete and incomplete windows.
size : int
boundary : Boundary
input : 'T seq
Returns: DataSegment<'T array> seq

Type something to start searching.