# Seq

Namespace: Deedle.Internal

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  Signature: collections:ReadOnlyCollection<'?495473> [] -> comparer:IComparer<'?495473> -> '?495473 [] * (int64 * int64) [] list Type parameters: '?495473 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.  alignAllOrderedFew seqs comparer  Signature: seqs:ReadOnlyCollection<'T> [] -> comparer:IComparer<'T> -> 'T [] * (int64 * int64) [] list Type parameters: 'T 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)  alignAllOrderedMany seqs comparer  Signature: seqs:ReadOnlyCollection<'T> [] -> comparer:IComparer<'T> -> 'T [] * (int64 * int64) [] list Type parameters: 'T 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)  alignAllUnordered seqs  Signature: seqs:ReadOnlyCollection<'T> [] -> 'T [] * (int64 * int64) [] list Type parameters: 'T Align N unordered sequences of keys (performs union of the keys)  alignOrdered (...)  Signature: seq1:ReadOnlyCollection<'T> -> seq2:ReadOnlyCollection<'T> -> comparer:IComparer<'T> -> intersectionOnly:bool -> 'T [] * (int64 * int64) [] list Type parameters: 'T 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)  alignUnordered s1 s2 intersectionOnly  Signature: s1:ReadOnlyCollection<'?495479> -> s2:ReadOnlyCollection<'?495479> -> intersectionOnly:bool -> '?495479 [] * (int64 * int64) [] list Type parameters: '?495479 Align two unordered sequences of keys. Calls either alignUnorderedUnion or alignUnorderedIntersection, based on the intersectionOnly parameter.  alignUnorderedIntersection seq1 seq2  Signature: seq1:ReadOnlyCollection<'T> -> seq2:ReadOnlyCollection<'T> -> 'T [] * (int64 * int64) [] list Type parameters: 'T 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  alignUnorderedUnion seq1 seq2  Signature: seq1:ReadOnlyCollection<'T> -> seq2:ReadOnlyCollection<'T> -> 'T [] * (int64 * int64) [] list Type parameters: 'T 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  choosel f input  Signature: f:(int64 -> '?495423 -> '?495424 option) -> input:seq<'?495423> -> seq<'?495424> Type parameters: '?495423, '?495424 Same as Seq.choose but passes 64 bit index (l stands for long) to the function  chunkedWhile f input  Signature: f:('?495451 -> '?495451 -> bool) -> input:seq<'?495451> -> seq<'?495451 []> Type parameters: '?495451 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<'?495455> -> seq> Type parameters: '?495455 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.  chunkRangesWhile f input  Signature: f:('?495461 -> '?495461 -> bool) -> input:seq<'?495461> -> seq Type parameters: '?495461 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.  chunkRangesWithBounds (...)  Signature: size:int64 -> boundary:Boundary -> length: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).  getEnumerator s  Signature: s:seq<'?495445> -> IEnumerator<'?495445> Type parameters: '?495445 Calls the GetEnumerator method. Simple function to guide type inference.  headOrNone input  Signature: input:seq<'?495441> -> '?495441 option Type parameters: '?495441 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.  lastAndLength input  Signature: input:seq<'?495419> -> '?495419 * int Type parameters: '?495419 Returns the last element and the length of a sequence (using just a single iteration over the sequence)  lastFew count input  Signature: count:int -> input:seq<'?495443> -> seq<'?495443> Type parameters: '?495443 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.  mapl f input  Signature: f:(int64 -> '?495426 -> '?495427) -> input:seq<'?495426> -> seq<'?495427> Type parameters: '?495426, '?495427 Same as Seq.map but passes 64 bit index (l stands for long) to the function  range lo hi  Signature: lo:^T -> hi:^T -> IEnumerable<^T> 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.  rangeStep lo step hi  Signature: lo:^T -> step:^T -> hi:^T -> IEnumerable<^T> 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.  skipAtMost count input  Signature: count:int -> input:seq<'?495429> -> seq<'?495429> Type parameters: '?495429 Skip at most the specified number of elements. This is like Seq.skip, but it does not throw when the sequence is shorter.  startAndEnd startCount endCount input  Signature: startCount:int -> endCount:int -> input:seq<'?495447> -> seq> Type parameters: '?495447 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<'?495465> -> ('?495465 * '?495465) option Type parameters: '?495465 Returns the first and the last element from a sequence or 'None' if the sequence is empty  uniqueBy f input  Signature: f:('?495416 -> '?495417) -> input:seq<'?495416> -> '?495417 Type parameters: '?495416, '?495417 If the projection returns the same value for all elements, then it returns the value. Otherwise it throws an exception.  unreduce f start  Signature: f:('?495421 -> '?495421) -> start:'?495421 -> seq<'?495421> Type parameters: '?495421 Generate infinite sequence using the specified function. The initial state is returned as the first element.  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> 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 values, which makes it easy to distinguish between complete and incomplete windows.  windowRangesWhile f input  Signature: f:('T -> 'T -> bool) -> input:seq<'T> -> seq 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. The function returns the windows as pairs of their indices.  windowRangesWithBounds (...)  Signature: size:int64 -> boundary:Boundary -> length: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).