6.3. LINQ

The LINQ module provides query-style operations on sequences: filtering (where_), projection (select), sorting (order, order_by), deduplication (distinct), pagination (skip, take), aggregation (sum, average, aggregate), and element access (first, last).

See also Boost module for LINQ for pipe-syntax macros with underscore shorthand. See tutorial_linq for a hands-on tutorial.

All functions and symbols are in “linq” module, use require to get access to it.

require daslib/linq

Example:

require daslib/linq

    [export]
    def main() {
        var src <- [iterator for (x in range(10)); x]
        var evens <- where_(src, $(x : int) : bool { return x % 2 == 0; })
        for (v in evens) {
            print("{v} ")
        }
        print("\n")
    }
    // output:
    // 0 2 4 6 8

6.3.1. Sorting data

6.3.1.1. order

order(a: array<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): array<TT>

Sorts an array

Arguments:
  • a : array<auto(TT)>

  • fun : block<(v1:TT;v2:TT):bool>

order(arr: array<auto(TT)>): array<TT>
order(a: iterator<auto(TT)>): iterator<TT>
order(a: iterator<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): iterator<TT>

6.3.1.2. order_by

order_by(a: array<auto(TT)>; key: auto): array<TT>

Sorts an array

Arguments:
  • a : array<auto(TT)>

  • key : auto

order_by(a: iterator<auto(TT)>; key: auto): iterator<TT>

6.3.1.3. order_by_descending

order_by_descending(a: array<auto(TT)>; key: auto): array<TT>

Sorts an array in descending order

Arguments:
  • a : array<auto(TT)>

  • key : auto

order_by_descending(a: iterator<auto(TT)>; key: auto): iterator<TT>

order_by_descending_inplace(buffer: array<auto(TT)>; key: auto): auto

Sorts an array in descending order in place

Arguments:
  • buffer : array<auto(TT)>

  • key : auto

order_by_descending_to_array(a: iterator<auto(TT)>; key: auto): array<TT>

Sorts an iterator in descending order and returns an array

Arguments:
  • a : iterator<auto(TT)>

  • key : auto

order_by_inplace(buffer: array<auto(TT)>; key: auto): auto

Sorts an array in place

Arguments:
  • buffer : array<auto(TT)>

  • key : auto

order_by_to_array(a: iterator<auto(TT)>; key: auto): array<TT>

Sorts an iterator and returns an array

Arguments:
  • a : iterator<auto(TT)>

  • key : auto

6.3.1.4. order_descending

order_descending(a: array<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): array<TT>

Sorts an array in descending order

Arguments:
  • a : array<auto(TT)>

  • fun : block<(v1:TT;v2:TT):bool>

order_descending(arr: array<auto(TT)>): array<TT>
order_descending(a: iterator<auto(TT)>): iterator<TT>
order_descending(a: iterator<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): iterator<TT>

6.3.1.5. order_descending_inplace

order_descending_inplace(buffer: array<auto(TT)>): auto

Sorts an array in descending order in place

Arguments:
  • buffer : array<auto(TT)>

order_descending_inplace(buffer: array<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): auto

6.3.1.6. order_descending_to_array

order_descending_to_array(a: iterator<auto(TT)>): array<TT>

Sorts an iterator in descending order and returns an array

Arguments:
  • a : iterator<auto(TT)>

order_descending_to_array(a: iterator<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): array<TT>

6.3.1.7. order_inplace

order_inplace(buffer: array<auto(TT)>): auto

Sorts an array in place

Arguments:
  • buffer : array<auto(TT)>

order_inplace(buffer: array<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): auto

6.3.1.8. order_to_array

order_to_array(a: iterator<auto(TT)>): array<TT>

Sorts an iterator and returns an array

Arguments:
  • a : iterator<auto(TT)>

order_to_array(a: iterator<auto(TT)>; fun: block<(v1:TT;v2:TT):bool>): array<TT>

6.3.1.9. order_unique_folded

order_unique_folded(a: array<auto(TT)>): array<TT>

sort and remove duplicate elements from an array

Arguments:
  • a : array<auto(TT)>

order_unique_folded(a: iterator<auto(TT)>): array<TT>

order_unique_folded_inplace(a: array<auto(TT)>): auto

sort and remove duplicate elements from an array

Arguments:
  • a : array<auto(TT)>

6.3.1.10. reverse

reverse(a: array<auto(TT)>): array<TT>

Reverses an array

Arguments:
  • a : array<auto(TT)>

reverse(a: iterator<auto(TT)>): iterator<TT>

reverse_inplace(buffer: array<auto(TT)>): auto

Reverses an array in place

Arguments:
  • buffer : array<auto(TT)>

reverse_to_array(a: iterator<auto(TT)>): array<TT>

Reverses an iterator and returns an array

Arguments:
  • a : iterator<auto(TT)>

6.3.2. Top-N selection

6.3.2.1. top_n

top_n(arr: array<auto(TT)>; n: int): array<TT>

Returns the n smallest elements of arr (by <), sorted ascending.

Arguments:
  • arr : array<auto(TT)>

  • n : int

top_n(a: iterator<auto(TT)>; n: int): array<TT>

6.3.2.2. top_n_by

top_n_by(arr: array<auto(TT)>; n: int; key: auto): array<TT>

Returns the n smallest elements of arr by key(element), sorted ascending. n <= 0 or empty arr yields an empty result.

Arguments:
  • arr : array<auto(TT)>

  • n : int

  • key : auto

top_n_by(a: iterator<auto(TT)>; n: int; key: auto): array<TT>

6.3.2.3. top_n_by_descending

top_n_by_descending(arr: array<auto(TT)>; n: int; key: auto): array<TT>

Returns the n largest elements of arr by key(element), sorted descending. n <= 0 or empty arr yields an empty result.

Arguments:
  • arr : array<auto(TT)>

  • n : int

  • key : auto

top_n_by_descending(a: iterator<auto(TT)>; n: int; key: auto): array<TT>

6.3.2.4. top_n_by_with_cmp

top_n_by_with_cmp(arr: array<auto(TT)>; n: int; cmp: block<(v1:TT;v2:TT):bool>): array<TT>

Returns the n smallest-per-cmp elements of arr. Pass a reversed comparator to extract the n largest instead.

Arguments:
  • arr : array<auto(TT)>

  • n : int

  • cmp : block<(v1:TT;v2:TT):bool>

top_n_by_with_cmp(a: iterator<auto(TT)>; n: int; cmp: block<(v1:TT;v2:TT):bool>): array<TT>

6.3.2.5. top_n_descending

top_n_descending(arr: array<auto(TT)>; n: int): array<TT>

Returns the n largest elements of arr (by <), sorted descending.

Arguments:
  • arr : array<auto(TT)>

  • n : int

top_n_descending(a: iterator<auto(TT)>; n: int): array<TT>

6.3.3. Set operations

6.3.3.1. distinct

distinct(a: array<auto(TT)>): array<TT>

Returns distinct elements from an array

Arguments:
  • a : array<auto(TT)>

distinct(a: iterator<auto(TT)>): iterator<TT>

6.3.3.2. distinct_by

distinct_by(a: array<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns distinct elements from an array based on a key

Arguments:
  • a : array<auto(TT)>

  • key : block<(arg:TT):auto>

distinct_by(a: iterator<auto(TT)>; key: block<(arg:TT):auto>): iterator<TT>

distinct_by_inplace(a: array<auto(TT)>; key: block<(arg:TT):auto>): auto

Returns distinct elements from an array based on a key in place

Arguments:
  • a : array<auto(TT)>

  • key : block<(arg:TT):auto>

distinct_by_to_array(a: iterator<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns distinct elements from an iterator based on a key and returns an array

Arguments:
  • a : iterator<auto(TT)>

  • key : block<(arg:TT):auto>

distinct_inplace(a: array<auto(TT)>): auto

Returns distinct elements from an array in place

Arguments:
  • a : array<auto(TT)>

distinct_to_array(a: iterator<auto(TT)>): array<TT>

Returns distinct elements from an iterator and returns an array

Arguments:
  • a : iterator<auto(TT)>

6.3.3.3. except

except(src: array<auto(TT)>; exclude: array<auto(TT)>): array<TT>

Returns elements from the first array that are not in the second array

Arguments:
  • src : array<auto(TT)>

  • exclude : array<auto(TT)>

except(src: iterator<auto(TT)>; exclude: iterator<auto(TT)>): iterator<TT>

6.3.3.4. except_by

except_by(src: array<auto(TT)>; exclude: array<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns elements from the first array that are not in the second array by key

Arguments:
  • src : array<auto(TT)>

  • exclude : array<auto(TT)>

  • key : block<(arg:TT):auto>

except_by(src: iterator<auto(TT)>; exclude: iterator<auto(TT)>; key: block<(arg:TT):auto>): iterator<TT>

except_by_to_array(src: iterator<auto(TT)>; exclude: iterator<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns elements from the first iterator that are not in the second iterator by key and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • exclude : iterator<auto(TT)>

  • key : block<(arg:TT):auto>

except_to_array(src: iterator<auto(TT)>; exclude: iterator<auto(TT)>): array<TT>

Returns elements from the first iterator that are not in the second iterator and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • exclude : iterator<auto(TT)>

6.3.3.5. intersect

intersect(srca: array<auto(TT)>; srcb: array<auto(TT)>): array<TT>

Returns elements that are present in both arrays

Arguments:
  • srca : array<auto(TT)>

  • srcb : array<auto(TT)>

intersect(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>): iterator<TT>

6.3.3.6. intersect_by

intersect_by(srca: array<auto(TT)>; srcb: array<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns elements that are present in both arrays by key

Arguments:
  • srca : array<auto(TT)>

  • srcb : array<auto(TT)>

  • key : block<(arg:TT):auto>

intersect_by(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>; key: block<(arg:TT):auto>): iterator<TT>

intersect_by_to_array(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns elements that are present in both iterators by key and returns an array

Arguments:
  • srca : iterator<auto(TT)>

  • srcb : iterator<auto(TT)>

  • key : block<(arg:TT):auto>

intersect_to_array(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>): array<TT>

Returns elements that are present in both iterators and returns an array

Arguments:
  • srca : iterator<auto(TT)>

  • srcb : iterator<auto(TT)>

6.3.3.7. union

union(srca: array<auto(TT)>; srcb: array<auto(TT)>): array<TT>

Returns distinct elements from the concatenation of two arrays

Arguments:
  • srca : array<auto(TT)>

  • srcb : array<auto(TT)>

union(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>): iterator<TT>

6.3.3.8. union_by

union_by(srca: array<auto(TT)>; srcb: array<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns distinct elements from the concatenation of two arrays by key

Arguments:
  • srca : array<auto(TT)>

  • srcb : array<auto(TT)>

  • key : block<(arg:TT):auto>

union_by(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>; key: block<(arg:TT):auto>): iterator<TT>

union_by_to_array(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

Returns distinct elements from the concatenation of two iterators by key and returns an array

Arguments:
  • srca : iterator<auto(TT)>

  • srcb : iterator<auto(TT)>

  • key : block<(arg:TT):auto>

union_to_array(srca: iterator<auto(TT)>; srcb: iterator<auto(TT)>): array<TT>

Returns distinct elements from the concatenation of two iterators and returns an array

Arguments:
  • srca : iterator<auto(TT)>

  • srcb : iterator<auto(TT)>

6.3.3.9. unique

unique(a: array<auto(TT)>): array<TT>

sort and remove duplicate elements from an array

Arguments:
  • a : array<auto(TT)>

unique(a: iterator<auto(TT)>): iterator<TT>

6.3.3.10. unique_by

unique_by(a: array<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

sort and remove duplicate elements from an array based on a key

Arguments:
  • a : array<auto(TT)>

  • key : block<(arg:TT):auto>

unique_by(a: iterator<auto(TT)>; key: block<(arg:TT):auto>): iterator<TT>

unique_by_inplace(a: array<auto(TT)>; key: block<(arg:TT):auto>): auto

remove duplicate elements from an array based on a key in place

Arguments:
  • a : array<auto(TT)>

  • key : block<(arg:TT):auto>

unique_by_to_array(a: iterator<auto(TT)>; key: block<(arg:TT):auto>): array<TT>

sort and remove duplicate elements from an iterator based on a key and returns an array

Arguments:
  • a : iterator<auto(TT)>

  • key : block<(arg:TT):auto>

unique_inplace(a: array<auto(TT)>): auto

remove duplicate elements from sorted array in place

Arguments:
  • a : array<auto(TT)>

unique_key(a: auto): auto

generates unique key of workhorse type for the value

Arguments:
  • a : auto

unique_to_array(a: iterator<auto(TT)>): array<TT>

sort and remove duplicate elements from an iterator and returns an array

Arguments:
  • a : iterator<auto(TT)>

6.3.4. Concatenation operations

6.3.4.1. append

append(arr: array<auto(TT)>; value: TT): array<TT>

Appends a value to the end of an array

Arguments:
  • arr : array<auto(TT)>

  • value : TT

append(it: iterator<auto(TT)>; value: TT): iterator<TT>

append_inplace(arr: array<auto(TT)>; value: TT): auto

Appends a value to the end of an array in place

Arguments:
  • arr : array<auto(TT)>

  • value : TT

append_to_array(it: iterator<auto(TT)>; value: TT): array<TT>

Appends a value to the end of an iterator and returns an array

Arguments:
  • it : iterator<auto(TT)>

  • value : TT

6.3.4.2. concat

concat(a: array<auto(TT)>; b: array<auto(TT)>): array<TT>

Concatenates two arrays

Arguments:
  • a : array<auto(TT)>

  • b : array<auto(TT)>

concat(a: iterator<auto(TT)>; b: iterator<auto(TT)>): iterator<TT>

concat_inplace(a: array<auto(TT)>; b: array<auto(TT)>): auto

Concatenates two arrays in place

Arguments:
  • a : array<auto(TT)>

  • b : array<auto(TT)>

concat_to_array(a: iterator<auto(TT)>; b: iterator<auto(TT)>): array<TT>

Concatenates two iterators and returns an array

Arguments:
  • a : iterator<auto(TT)>

  • b : iterator<auto(TT)>

6.3.4.3. prepend

prepend(arr: array<auto(TT)>; value: TT): array<TT>

Prepends a value to the beginning of an array

Arguments:
  • arr : array<auto(TT)>

  • value : TT

prepend(it: iterator<auto(TT)>; value: TT): iterator<TT>

prepend_inplace(arr: array<auto(TT)>; value: TT): auto

Prepends a value to the beginning of an array in place

Arguments:
  • arr : array<auto(TT)>

  • value : TT

prepend_to_array(it: iterator<auto(TT)>; value: TT): array<TT>

Prepends a value to the beginning of an iterator and returns an array

Arguments:
  • it : iterator<auto(TT)>

  • value : TT

6.3.5. Generation operations

default_empty(src: iterator<auto(TT)>): iterator<TT>

Returns the elements of the iterator, or a default value if the iterator is empty

Arguments:
  • src : iterator<auto(TT)>

empty(typ: auto(TT)): iterator<TT>

Returns an empty iterator of the specified type

Arguments:
  • typ : auto(TT)

range_sequence(start: int; count: int): iterator<int>

Generates a sequence of integers within a specified range

Arguments:
  • start : int

  • count : int

repeat(element: auto(TT); count: int): iterator<TT>

Generates a sequence that contains one repeated value

Arguments:
  • element : auto(TT)

  • count : int

6.3.6. Aggregation operations

6.3.6.1. aggregate

aggregate(src: array<auto(TT)>; seed: auto(AGG); func: block<(acc:AGG;x:TT):AGG>): AGG

Aggregates elements in an array using a seed and a function

Arguments:
  • src : array<auto(TT)>

  • seed : auto(AGG)

  • func : block<(acc:AGG;x:TT):AGG>

aggregate(src: iterator<auto(TT)>; seed: auto(AGG); func: block<(acc:AGG;x:TT):AGG>): AGG

6.3.6.2. average

average(src: array<auto(TT)>): double

Averages elements in an array. Always returns double (matches SQL AVG / C# Average); element type must cast to double.

Arguments:
  • src : array<auto(TT)>

average(src: iterator<auto(TT)>): double

6.3.6.3. count

count(a: array<auto(TT)>): int

Counts elements in an array

Arguments:
  • a : array<auto(TT)>

count(a: array<auto(TT)>; predicate: block<(arg:TT):bool>): int
count(a: iterator<auto(TT)>): int
count(a: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): int

6.3.6.4. long_count

long_count(a: array<auto(TT)>): int64

Counts elements in an array, using a long integer

Arguments:
  • a : array<auto(TT)>

long_count(a: array<auto(TT)>; predicate: block<(arg:TT):bool>): int64
long_count(a: iterator<auto(TT)>): int64
long_count(a: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): int64

6.3.6.5. max

max(src: array<auto(TT)>): TT

Finds the maximum element in an array

Arguments:
  • src : array<auto(TT)>

max(src: iterator<auto(TT)>): TT

6.3.6.6. max_by

max_by(src: array<auto(TT)>; key: auto): TT

Finds the maximum element in an array by key

Arguments:
  • src : array<auto(TT)>

  • key : auto

max_by(src: iterator<auto(TT)>; key: auto): TT

6.3.6.7. min

min(src: array<auto(TT)>): TT

Finds the minimum element in an array

Arguments:
  • src : array<auto(TT)>

min(src: iterator<auto(TT)>): TT

6.3.6.8. min_by

min_by(src: array<auto(TT)>; key: auto): TT

Finds the minimum element in an array by key

Arguments:
  • src : array<auto(TT)>

  • key : auto

min_by(src: iterator<auto(TT)>; key: auto): TT

6.3.6.9. min_max

min_max(src: array<auto(TT)>): tuple<TT;TT>

Finds the minimum and maximum elements in an array

Arguments:
  • src : array<auto(TT)>

min_max(src: iterator<auto(TT)>): tuple<TT;TT>

6.3.6.10. min_max_average

min_max_average(src: array<auto(TT)>): tuple<TT;TT;TT>

Finds the minimum, maximum, and average elements in an array

Arguments:
  • src : array<auto(TT)>

min_max_average(src: iterator<auto(TT)>): tuple<TT;TT;TT>

6.3.6.11. min_max_average_by

min_max_average_by(src: array<auto(TT)>; key: auto): tuple<TT;TT;TT>

Finds the minimum, maximum, and average elements in an array by key

Arguments:
  • src : array<auto(TT)>

  • key : auto

min_max_average_by(src: iterator<auto(TT)>; key: auto): tuple<TT;TT;TT>

6.3.6.12. min_max_by

min_max_by(src: array<auto(TT)>; key: auto): tuple<TT;TT>

Finds the minimum and maximum elements in an array by key

Arguments:
  • src : array<auto(TT)>

  • key : auto

min_max_by(src: iterator<auto(TT)>; key: auto): tuple<TT;TT>

6.3.6.13. sum

sum(src: array<auto(TT)>): TT

Sums elements in an array

Arguments:
  • src : array<auto(TT)>

sum(src: iterator<auto(TT)>): TT

6.3.7. Filtering data

6.3.7.1. where

where_(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Filters elements in an array based on a predicate

Arguments:
  • src : array<auto(TT)>

  • predicate : block<(arg:TT):bool>

where_(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): iterator<TT>

where_to_array(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Filters elements in an iterator based on a predicate and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • predicate : block<(arg:TT):bool>

6.3.8. Partitioning data

6.3.8.1. chunk

chunk(src: array<auto(TT)>; size: int): array<array<TT>>

Splits an array into chunks of a specified size

Arguments:
  • src : array<auto(TT)>

  • size : int

chunk(src: iterator<auto(TT)>; size: int): iterator<array<TT>>

chunk_to_array(src: iterator<auto(TT)>; size: int): array<array<TT>>

Splits an iterator into chunks of a specified size and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • size : int

6.3.8.2. skip

skip(arr: array<auto(TT)>; total: int): array<TT>

Yields all but the first total elements

Arguments:
  • arr : array<auto(TT)>

  • total : int

skip(src: iterator<auto(TT)>; total: int): iterator<TT>

skip_inplace(arr: array<auto(TT)>; total: int): auto

Removes the first total elements from an array in place

Arguments:
  • arr : array<auto(TT)>

  • total : int

6.3.8.3. skip_last

skip_last(arr: array<auto(TT)>; total: int): array<TT>

Yields all but the last total elements from an array

Arguments:
  • arr : array<auto(TT)>

  • total : int

skip_last(src: iterator<auto(TT)>; total: int): iterator<TT>

skip_last_inplace(arr: array<auto(TT)>; total: int): auto

Removes the last total elements from an array in place

Arguments:
  • arr : array<auto(TT)>

  • total : int

skip_last_to_array(src: iterator<auto(TT)>; total: int): array<TT>

Yields all but the last total elements from an iterator and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • total : int

skip_to_array(src: iterator<auto(TT)>; total: int): array<TT>

Yields all but the first total elements and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • total : int

6.3.8.4. skip_while

skip_while(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Skips all elements of an array while the predicate is true

Arguments:
  • src : array<auto(TT)>

  • predicate : block<(arg:TT):bool>

skip_while(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): iterator<TT>

skip_while_to_array(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Skips all elements of an iterator while the predicate is true and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • predicate : block<(arg:TT):bool>

6.3.8.5. take

take(arr: array<auto(TT)>; total: int): array<TT>

Yields only the first total elements

Arguments:
  • arr : array<auto(TT)>

  • total : int

take(src: array<auto(TT)>; from: range): array<TT>
take(src: iterator<auto(TT)>; from: range): iterator<TT>
take(src: iterator<auto(TT)>; total: int): iterator<TT>

6.3.8.6. take_inplace

take_inplace(arr: array<auto(TT)>; from: range): auto

Keeps only a range of elements in an array in place

Arguments:
  • arr : array<auto(TT)>

  • from : range

take_inplace(arr: array<auto(TT)>; total: int): auto

6.3.8.7. take_last

take_last(arr: array<auto(TT)>; total: int): array<TT>

Yields only the last total elements from an array

Arguments:
  • arr : array<auto(TT)>

  • total : int

take_last(src: iterator<auto(TT)>; total: int): iterator<TT>

take_last_inplace(arr: array<auto(TT)>; total: int): auto

Keeps only the last total elements in an array in place

Arguments:
  • arr : array<auto(TT)>

  • total : int

take_last_to_array(src: iterator<auto(TT)>; total: int): array<TT>

Yields only the last total elements from an iterator and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • total : int

6.3.8.8. take_to_array

take_to_array(src: iterator<auto(TT)>; from: range): array<TT>

Yields a range of elements from an iterator and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • from : range

take_to_array(src: iterator<auto(TT)>; total: int): array<TT>

6.3.8.9. take_while

take_while(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Yields only the elements of an array while the predicate is true

Arguments:
  • src : array<auto(TT)>

  • predicate : block<(arg:TT):bool>

take_while(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): iterator<TT>

take_while_to_array(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Yields only the elements of an iterator while the predicate is true and returns an array

Arguments:
  • src : iterator<auto(TT)>

  • predicate : block<(arg:TT):bool>

6.3.9. Joining

6.3.9.1. cross_join

cross_join(srca: array<auto(TA)>; srcb: array<auto(TB)>; result: auto) : array<typedecl(result(type<TA>, type<TB>))>

Cross join — every (TA, TB) pair

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • result : auto

cross_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; result: auto) : iterator<typedecl(result(type<TA>, type<TB>))>

cross_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; result: auto) : array<typedecl(result(type<TA>, type<TB>))>

Cross join returning an array. srcb is materialized first.

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • result : auto

6.3.9.2. full_outer_join

full_outer_join(srca: array<auto(TA)>; srcb: array<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

Full outer join — both sides surface; unmatched rows pair with none on the other side

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

full_outer_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : iterator<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

full_outer_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

Full outer join returning an array

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

6.3.9.3. group_join

group_join(srca: array<auto(TA)>; srcb: array<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<array<TB -const -&>>))>

we pass TA, and sequence of TB to ‘result’

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

group_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : iterator<typedecl(result(type<TA>, type<array<TB -const -&>>))>

group_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<array<TB -const -&>>))>

we pass TA, and sequence of TB to ‘result’

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

6.3.9.4. join

join(srca: array<auto(TA)>; srcb: array<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<TB>))>

Joins two arrays based on matching keys (inner join)

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : iterator<typedecl(result(type<TA>, type<TB>))>

join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<TB>))>

Joins two iterators based on matching keys (inner join) and returns an array

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

6.3.9.5. left_join

left_join(srca: array<auto(TA)>; srcb: array<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

Left outer join — every TA emits at least one row; right side is Option<TB> (none when no match)

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

left_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : iterator<typedecl(result(type<TA>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

left_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<TA>, type<$Option(type<TB -const>)>"Option"type<TB -const>))>

Left outer join returning an array

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

6.3.9.6. right_join

right_join(srca: array<auto(TA)>; srcb: array<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<TB>))>

Right outer join — every TB emits at least one row; left side is Option<TA> (none when no left match)

Arguments:
  • srca : array<auto(TA)>

  • srcb : array<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

right_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : iterator<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<TB>))>

right_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto; keyb: auto; result: auto) : array<typedecl(result(type<$Option(type<TA -const>)>"Option"type<TA -const>, type<TB>))>

Right outer join returning an array

Arguments:
  • srca : iterator<auto(TA)>

  • srcb : iterator<auto(TB)>

  • keya : auto

  • keyb : auto

  • result : auto

6.3.10. Grouping

6.3.10.1. group_by

group_by(source: array<auto(TT)>; key: auto; element_selector: auto; result_selector: auto): auto

Groups the elements of an array according to a specified key selector function

Arguments:
  • source : array<auto(TT)>

  • key : auto

  • element_selector : auto

  • result_selector : auto

group_by(source: iterator<auto(TT)>; key: auto; element_selector: auto; result_selector: auto): auto

6.3.10.2. group_by_lazy

group_by_lazy(source: array<auto(TT)>; key: auto): auto

IGrouping shape over an array — yields (key, array<TT>) per group.

Arguments:
  • source : array<auto(TT)>

  • key : auto

group_by_lazy(source: iterator<auto(TT)>; key: auto): auto

group_by_lazy_to_array(source: iterator<auto(TT)>; key: auto): auto

IGrouping shape returning an array — see group_by_lazy.

Arguments:
  • source : iterator<auto(TT)>

  • key : auto

group_by_to_array(source: iterator<auto(TT)>; key: auto; element_selector: auto; result_selector: auto): auto

Groups the elements of an iterator according to a specified key selector function and returns an array

Arguments:
  • source : iterator<auto(TT)>

  • key : auto

  • element_selector : auto

  • result_selector : auto

6.3.10.3. having

having_(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Post-aggregate filter on an array — semantics match where_; preserved as a distinct call so SQL translation can route to HAVING.

Arguments:
  • src : array<auto(TT)>

  • predicate : block<(arg:TT):bool>

having_(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): iterator<TT>

having_to_array(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): array<TT>

Post-aggregate filter returning an array — see having_.

Arguments:
  • src : iterator<auto(TT)>

  • predicate : block<(arg:TT):bool>

6.3.11. Querying data

6.3.11.1. all

all(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): bool

Returns true if all elements in the array satisfy the predicate

Arguments:
  • src : array<auto(TT)>

  • predicate : block<(arg:TT):bool>

all(src: iterator<auto(TT) const>; predicate: block<(arg:TT):bool>): bool

6.3.11.2. any

any(src: array<auto(TT)>): bool

Returns true if the array has at least one element

Arguments:
  • src : array<auto(TT)>

any(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): bool
any(src: iterator<auto(TT)>): bool
any(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): bool

6.3.11.3. contains

contains(src: array<auto(TT)>; element: TT): bool

Returns true if the element is present in the array

Arguments:
  • src : array<auto(TT)>

  • element : TT

contains(src: iterator<auto(TT) const>; element: TT): bool

6.3.11.4. none

none(src: array<auto(TT)>): bool

Returns true if the array has no elements

Arguments:
  • src : array<auto(TT)>

none(src: array<auto(TT)>; predicate: block<(arg:TT):bool>): bool
none(src: iterator<auto(TT)>): bool
none(src: iterator<auto(TT)>; predicate: block<(arg:TT):bool>): bool

6.3.12. Element operations

6.3.12.1. element_at

element_at(src: array<auto(TT)>; index: int): TT

Returns the element at the specified index

Arguments:
  • src : array<auto(TT)>

  • index : int

element_at(src: iterator<auto(TT)>; index: int): TT

6.3.12.2. element_at_or_default

element_at_or_default(src: array<auto(TT)>; index: int): TT

Returns the element at the specified index, or a default value if the index is out of range

Arguments:
  • src : array<auto(TT)>

  • index : int

element_at_or_default(src: iterator<auto(TT)>; index: int): TT

6.3.12.3. first

first(src: array<auto(TT)>): TT

Returns the first element of an array

Arguments:
  • src : array<auto(TT)>

first(src: iterator<auto(TT)>): TT

6.3.12.4. first_or_default

first_or_default(src: array<auto(TT)>; defaultValue: TT): TT

Returns the first element of an array, or a default value if the array is empty

Arguments:
  • src : array<auto(TT)>

  • defaultValue : TT

first_or_default(src: iterator<auto(TT)>; defaultValue: TT): TT

6.3.12.5. last

last(src: array<auto(TT)>): TT

Returns the last element of an array

Arguments:
  • src : array<auto(TT)>

last(src: iterator<auto(TT)>): TT

6.3.12.6. last_or_default

last_or_default(src: array<auto(TT)>; defaultValue: TT): TT

Returns the last element of an array, or a default value if the array is empty

Arguments:
  • src : array<auto(TT)>

  • defaultValue : TT

last_or_default(src: iterator<auto(TT)>; defaultValue: TT): TT

6.3.12.7. single

single(src: array<auto(TT)>): TT

Returns the only element of an array, and throws if there is not exactly one element

Arguments:
  • src : array<auto(TT)>

single(src: iterator<auto(TT)>): TT

6.3.12.8. single_or_default

single_or_default(src: array<auto(TT)>; defaultValue: TT): TT

Returns the only element of an array, or a default value if there is not exactly one element

Arguments:
  • src : array<auto(TT)>

  • defaultValue : TT

single_or_default(src: iterator<auto(TT)>; defaultValue: TT): TT

6.3.13. Transform operations

6.3.13.1. select

select(src: array<auto(TT)>): array<tuple<int;TT>>

Projects each element of an array into a new form

Arguments:
  • src : array<auto(TT)>

select(src: array<auto(TT)>; result_selector: auto) : array<typedecl(result_selector(type<TT>))>
select(src: iterator<auto(TT)>): iterator<tuple<int;TT>>
select(src: iterator<auto(TT)>; result_selector: auto) : iterator<typedecl(result_selector(type<TT>))>

6.3.13.2. select_many

select_many(src: array<auto(TT)>; collection_selector: auto; result_selector: auto) : array<typedecl(result_selector(iter_type(collection_selector(type<TT>))))>

Projects each element of an array to an iterator and flattens the resulting iterators into one array

Arguments:
  • src : array<auto(TT)>

  • collection_selector : auto

  • result_selector : auto

select_many(src: array<auto(TT)>; result_selector: auto) : array<typedecl(result_selector(iter_type(type<TT>)))>
select_many(src: iterator<auto(TT)>; collection_selector: auto; result_selector: auto) : iterator<typedecl(result_selector(iter_type(collection_selector(type<TT>))))>
select_many(src: iterator<auto(TT)>; result_selector: auto) : iterator<typedecl(result_selector(iter_type(type<TT>)))>

6.3.13.3. select_many_to_array

select_many_to_array(src: iterator<auto(TT)>; collection_selector: auto; result_selector: auto) : array<typedecl(result_selector(iter_type(collection_selector(type<TT>))))>

Projects each element of an iterator to an iterator and flattens the resulting iterators into one array

Arguments:
  • src : iterator<auto(TT)>

  • collection_selector : auto

  • result_selector : auto

select_many_to_array(src: iterator<auto(TT)>; result_selector: auto) : array<typedecl(result_selector(iter_type(type<TT>)))>

6.3.13.4. select_to_array

select_to_array(src: iterator<auto(TT)>): array<tuple<int;TT>>

Projects each element of an iterator into a new form and returns an array

Arguments:
  • src : iterator<auto(TT)>

select_to_array(src: iterator<auto(TT)>; result_selector: auto) : array<typedecl(result_selector(type<TT>))>

6.3.13.5. zip

zip(a: array<auto(TT)>; b: array<auto(UU)>): array<tuple<TT;UU>>

Merges two arrays into an array of tuples

Arguments:
  • a : array<auto(TT)>

  • b : array<auto(UU)>

zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>): array<tuple<TT;UU;WW>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>): array<tuple<TT;UU;WW;XX>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>): array<tuple<TT;UU;WW;XX;YY>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>): array<tuple<TT;UU;WW;XX;YY;ZZ>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>; g: array<auto(RR)>): array<tuple<TT;UU;WW;XX;YY;ZZ;RR>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>; g: array<auto(RR)>; h: array<auto(SS)>): array<tuple<TT;UU;WW;XX;YY;ZZ;RR;SS>>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>; g: array<auto(RR)>; h: array<auto(SS)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR;n:SS):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>, type<SS>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>; g: array<auto(RR)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; f: array<auto(ZZ)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; e: array<auto(YY)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; d: array<auto(XX)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; c: array<auto(WW)>; result_selector: block<(l:TT;r:UU;w:WW):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>))>
zip(a: array<auto(TT)>; b: array<auto(UU)>; result_selector: block<(l:TT;r:UU):auto>) : array<typedecl(result_selector(type<TT>, type<UU>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>): iterator<tuple<TT;UU>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; result_selector: block<(l:TT;r:UU):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>): iterator<tuple<TT;UU;WW>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; result_selector: block<(l:TT;r:UU;w:WW):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>): iterator<tuple<TT;UU;WW;XX>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>): iterator<tuple<TT;UU;WW;XX;YY>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>): iterator<tuple<TT;UU;WW;XX;YY;ZZ>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>): iterator<tuple<TT;UU;WW;XX;YY;ZZ;RR>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>))>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; h: iterator<auto(SS)>): iterator<tuple<TT;UU;WW;XX;YY;ZZ;RR;SS>>
zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; h: iterator<auto(SS)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR;n:SS):auto>) : iterator<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>, type<SS>))>

6.3.13.6. zip_to_array

zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>): array<tuple<TT;UU>>

Merges two iterators into an array of tuples

Arguments:
  • a : iterator<auto(TT)>

  • b : iterator<auto(UU)>

zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; result_selector: block<(l:TT;r:UU):auto>) : array<typedecl(result_selector(type<TT>, type<UU>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>): array<tuple<TT;UU;WW>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; result_selector: block<(l:TT;r:UU;w:WW):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>): array<tuple<TT;UU;WW;XX>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>): array<tuple<TT;UU;WW;XX;YY>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>): array<tuple<TT;UU;WW;XX;YY;ZZ>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>): array<tuple<TT;UU;WW;XX;YY;ZZ;RR>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>))>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; h: iterator<auto(SS)>): array<tuple<TT;UU;WW;XX;YY;ZZ;RR;SS>>
zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; c: iterator<auto(WW)>; d: iterator<auto(XX)>; e: iterator<auto(YY)>; f: iterator<auto(ZZ)>; g: iterator<auto(RR)>; h: iterator<auto(SS)>; result_selector: block<(l:TT;r:UU;w:WW;x:XX;y:YY;z:ZZ;m:RR;n:SS):auto>) : array<typedecl(result_selector(type<TT>, type<UU>, type<WW>, type<XX>, type<YY>, type<ZZ>, type<RR>, type<SS>))>

6.3.14. Conversion operations

6.3.14.1. to_sequence

to_sequence(a: array<auto(TT)>): iterator<TT>

Converts an array to an iterator

Arguments:
  • a : array<auto(TT)>!

to_sequence(a: array<auto(TT)>): iterator<TT>

to_sequence_move(a: array<auto(TT)>): iterator<TT>

Converts an array to an iterator, captures input

Arguments:
  • a : array<auto(TT)>

6.3.14.2. to_table

to_table(a: array<auto(TT)>; key: block<(v:TT):auto>; elementSelector: block<(v:TT):auto>) : table<typedecl(_::unique_key(type<TT>)), typedecl(elementSelector(type<TT>))>

Converts an array to a table

Arguments:
  • a : array<auto(TT)>

  • key : block<(v:TT):auto>

  • elementSelector : block<(v:TT):auto>

to_table(a: iterator<auto(TT)>; key: block<(v:TT):auto>; elementSelector: block<(v:TT):auto>) : table<typedecl(_::unique_key(type<TT>)), typedecl(elementSelector(type<TT>))>

6.3.15. Comparators and keys

6.3.15.1. less

less(a: auto; b: auto): bool

Compares two values, returns true if first is less than second

Arguments:
  • a : auto

  • b : auto

less(a: tuple<auto(TT);auto(UU);auto(VV);auto(WW)>; b: tuple<auto(TT);auto(UU);auto(VV);auto(WW)>): bool
less(a: tuple<auto(TT);auto(UU);auto(VV)>; b: tuple<auto(TT);auto(UU);auto(VV)>): bool
less(a: tuple<auto(TT);auto(UU)>; b: tuple<auto(TT);auto(UU)>): bool
less(a: tuple<auto(TT)>; b: tuple<auto(TT)>): bool

6.3.15.2. sequence_equal

sequence_equal(first: array<auto(TT)>; second: array<auto(TT)>): bool

Checks if two arrays are equal

Arguments:
  • first : array<auto(TT)>

  • second : array<auto(TT)>

sequence_equal(first: iterator<auto(TT)>; second: iterator<auto(TT)>): bool

6.3.15.3. sequence_equal_by

sequence_equal_by(first: array<auto(TT)>; second: array<auto(TT)>; key: block<(arg:TT):auto>): bool

Checks if two arrays are equal by key

Arguments:
  • first : array<auto(TT)>

  • second : array<auto(TT)>

  • key : block<(arg:TT):auto>

sequence_equal_by(first: iterator<auto(TT)>; second: iterator<auto(TT)>; key: block<(arg:TT):auto>): bool

6.3.16. Uncategorized

spliced_push_heap(buf: array<auto(TT)>; cmp: block<(x:TT;y:TT):bool>): auto

Thin re-export of sort_boost::push_heap so plan_decs_order_family’s bounded-heap splice can call it via _:: from any user module without requiring sort_boost directly.

Arguments:
  • buf : array<auto(TT)>

  • cmp : block<(x:TT;y:TT):bool>

spliced_pop_heap(buf: array<auto(TT)>; cmp: block<(x:TT;y:TT):bool>): auto

Thin re-export of sort_boost::pop_heap for the bounded-heap splice (see spliced_push_heap).

Arguments:
  • buf : array<auto(TT)>

  • cmp : block<(x:TT;y:TT):bool>