56. LINQ

The LINQ module implements LINQ (Language Integrated Query) capabilities in Daslang.

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

require daslib/linq

56.1. Sorting data

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

reverse_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

Reverses an array in place

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

reverse returns array<TT>

argument

argument type

a

array<auto(TT)> const

Reverses an iterator

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

reverse returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

Reverses an iterator

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

reverse_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

Reverses an iterator and returns an array

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

order_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

Sorts an array in place

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

order returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

Sorts an array

order(arr: array<auto(TT)> const)

order returns array<TT>

argument

argument type

arr

array<auto(TT)> const

Sorts an array

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

order_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

Sorts an iterator and returns an array

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

order_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array in place

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

order returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array

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

order returns array<TT>

argument

argument type

a

array<auto(TT)> const

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array

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

order_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an iterator and returns an array

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

order_descending_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array in descending order in place

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

order_descending returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array in descending order

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

order_descending returns array<TT>

argument

argument type

a

array<auto(TT)> const

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an array in descending order

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

order_descending_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

fun

block<(v1:TT const;v2:TT const):bool> const

Sorts an iterator in descending order and returns an array

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

order_by_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

key

auto const

Sorts an array in place

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

order_by returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

key

auto const

Sorts an array

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

order_by returns array<TT>

argument

argument type

a

array<auto(TT)> const

key

auto const

Sorts an array

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

order_by_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

key

auto const

Sorts an iterator and returns an array

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

order_by_descending_inplace returns auto

argument

argument type

buffer

array<auto(TT)>

key

auto const

Sorts an array in descending order in place

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

order_by_descending returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

key

auto const

Sorts an array in descending order

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

order_by_descending returns array<TT>

argument

argument type

a

array<auto(TT)> const

key

auto const

Sorts an array in descending order

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

order_by_descending_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

key

auto const

Sorts an iterator in descending order and returns an array

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

order_unique_folded returns array<TT>

argument

argument type

a

array<auto(TT)>

sort and remove duplicate elements from an iterator

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

order_unique_folded returns array<TT>

argument

argument type

a

iterator<auto(TT)>

sort and remove duplicate elements from an iterator

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

order_unique_folded_inplace returns auto

argument

argument type

a

array<auto(TT)>

sort and remove duplicate elements from an array

56.2. Set operations

unique_key(a: auto const)

unique_key returns auto

argument

argument type

a

auto const

! generates unique key of workhorse type for the value

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

distinct returns array<TT>

argument

argument type

a

array<auto(TT)> const

Returns distinct elements from an iterator

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

distinct_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

Returns distinct elements from an iterator and returns an array

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

distinct_inplace returns auto

argument

argument type

a

array<auto(TT)>

Returns distinct elements from an array in place

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

distinct returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

Returns distinct elements from an iterator

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

distinct_by returns array<TT>

argument

argument type

a

array<auto(TT)> const

key

block<(arg:TT const):auto> const

Returns distinct elements from an iterator based on a key TODO: specialize with const value vs var value of key, which can be captured.

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

distinct_by_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

distinct_by returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

Returns distinct elements from an iterator based on a key TODO: specialize with const value vs var value of key, which can be captured.

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

distinct_by_inplace returns auto

argument

argument type

a

array<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

unique returns iterator<TT>

argument

argument type

a

iterator<auto(TT)> const

sort and remove duplicate elements from an array

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

unique returns array<TT>

argument

argument type

a

array<auto(TT)> const

sort and remove duplicate elements from an array

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

unique_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)> const

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

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

unique_inplace returns auto

argument

argument type

a

array<auto(TT)>

remove duplicate elements from sorted array in place

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

unique_by returns iterator<TT>

argument

argument type

a

iterator<auto(TT)> const

key

block<(arg:TT const):auto> const

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

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

unique_by returns array<TT>

argument

argument type

a

array<auto(TT)> const

key

block<(arg:TT const):auto> const

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

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

unique_by_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)> const

key

block<(arg:TT const):auto> const

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

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

unique_by_inplace returns auto

argument

argument type

a

array<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

union returns array<TT>

argument

argument type

srca

array<auto(TT)>

srcb

array<auto(TT)>

Returns distinct elements from the concatenation of two iterators

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

union returns iterator<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

Returns distinct elements from the concatenation of two iterators

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

union_to_array returns array<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

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

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

union_by returns iterator<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

Returns distinct elements from the concatenation of two arrays by key

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

union_by returns array<TT>

argument

argument type

srca

array<auto(TT)> const

srcb

array<auto(TT)> const

key

block<(arg:TT const):auto> const

Returns distinct elements from the concatenation of two arrays by key

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

union_by_to_array returns array<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

except returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

exclude

iterator<auto(TT)>

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

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

except returns array<TT>

argument

argument type

src

array<auto(TT)> const

exclude

array<auto(TT)> const

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

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

except_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

exclude

iterator<auto(TT)>

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

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

except_by returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

exclude

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

except_by returns array<TT>

argument

argument type

src

array<auto(TT)> const

exclude

array<auto(TT)> const

key

block<(arg:TT const):auto> const

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

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

except_by_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

exclude

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

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

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

intersect returns iterator<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

Returns elements that are present in both arrays

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

intersect returns array<TT>

argument

argument type

srca

array<auto(TT)> const

srcb

array<auto(TT)> const

Returns elements that are present in both arrays

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

intersect_to_array returns array<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

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

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

intersect_by returns iterator<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

Returns elements that are present in both arrays by key

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

intersect_by returns array<TT>

argument

argument type

srca

array<auto(TT)> const

srcb

array<auto(TT)> const

key

block<(arg:TT const):auto> const

Returns elements that are present in both arrays by key

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

intersect_by_to_array returns array<TT>

argument

argument type

srca

iterator<auto(TT)>

srcb

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

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

56.3. Concatenation operations

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

concat returns array<TT>

argument

argument type

a

array<auto(TT)> const

b

array<auto(TT)> const

Concatenates two iterators

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

concat_to_array returns array<TT>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(TT)>

Concatenates two iterators and returns an array

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

concat returns iterator<TT>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(TT)>

Concatenates two iterators

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

concat_inplace returns auto

argument

argument type

a

array<auto(TT)>

b

array<auto(TT)> const

Concatenates two arrays in place

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

prepend returns array<TT>

argument

argument type

arr

array<auto(TT)> const

value

TT const

Prepends a value to the beginning of an iterator

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

prepend_to_array returns array<TT>

argument

argument type

it

iterator<auto(TT)>

value

TT const

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

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

prepend returns iterator<TT>

argument

argument type

it

iterator<auto(TT)>

value

TT const

Prepends a value to the beginning of an iterator

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

prepend_inplace returns auto

argument

argument type

arr

array<auto(TT)>

value

TT const

Prepends a value to the beginning of an array in place

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

append returns array<TT>

argument

argument type

arr

array<auto(TT)> const

value

TT const

Appends a value to the end of an iterator

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

append_to_array returns array<TT>

argument

argument type

it

iterator<auto(TT)>

value

TT const

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

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

append returns iterator<TT>

argument

argument type

it

iterator<auto(TT)>

value

TT const

Appends a value to the end of an iterator

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

append_inplace returns auto

argument

argument type

arr

array<auto(TT)>

value

TT const

Appends a value to the end of an array in place

56.4. Generation operations

range_sequence(start: int const; count: int const)

range_sequence returns iterator<int>

argument

argument type

start

int const

count

int const

Generates a sequence of integers within a specified range

empty(typ: auto(TT))

empty returns iterator<TT>

argument

argument type

typ

auto(TT)

Returns an empty iterator of the specified type

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

default_empty returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

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

repeat(element: auto(TT) const; count: int const)

repeat returns iterator<TT>

argument

argument type

element

auto(TT) const

count

int const

Generates a sequence that contains one repeated value

56.5. Aggregation operations

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

count returns int

argument

argument type

a

iterator<auto(TT)>

Counts elements in an array

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

count returns int

argument

argument type

a

array<auto(TT)> const

Counts elements in an array

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

long_count returns int64

argument

argument type

a

iterator<auto(TT)>

Counts elements in an array, using a long integer

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

long_count returns int64

argument

argument type

a

array<auto(TT)> const

Counts elements in an array, using a long integer

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

min returns TT

argument

argument type

src

iterator<auto(TT)>

Finds the minimum element in an array

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

min returns TT

argument

argument type

src

array<auto(TT)> const

Finds the minimum element in an array

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

min_by returns TT

argument

argument type

src

iterator<auto(TT)>

key

auto const

Finds the minimum element in an array by key

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

min_by returns TT

argument

argument type

src

array<auto(TT)> const

key

auto const

Finds the minimum element in an array by key

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

max returns TT

argument

argument type

src

iterator<auto(TT)>

Finds the maximum element in an array

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

max returns TT

argument

argument type

src

array<auto(TT)> const

Finds the maximum element in an array

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

max_by returns TT

argument

argument type

src

iterator<auto(TT)>

key

auto const

Finds the maximum element in an array by key

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

max_by returns TT

argument

argument type

src

array<auto(TT)> const

key

auto const

Finds the maximum element in an array by key

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

min_max returns tuple<TT;TT>

argument

argument type

src

iterator<auto(TT)>

Finds the minimum and maximum elements in an array

min_max(src: array<auto(TT)> const)

min_max returns tuple<TT;TT>

argument

argument type

src

array<auto(TT)> const

Finds the minimum and maximum elements in an array

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

min_max_by returns tuple<TT;TT>

argument

argument type

src

iterator<auto(TT)>

key

auto const

Finds the minimum and maximum elements in an array by key

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

min_max_by returns tuple<TT;TT>

argument

argument type

src

array<auto(TT)> const

key

auto const

Finds the minimum and maximum elements in an array by key

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

aggregate returns AGG

argument

argument type

src

iterator<auto(TT)>

seed

auto(AGG) const

func

block<(acc:AGG const;x:TT const):AGG> const

Aggregates elements in an array using a seed and a function

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

aggregate returns AGG

argument

argument type

src

array<auto(TT)> const

seed

auto(AGG) const

func

block<(acc:AGG const;x:TT const):AGG> const

Aggregates elements in an array using a seed and a function

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

sum returns TT

argument

argument type

src

iterator<auto(TT)>

Sums elements in an array

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

sum returns TT

argument

argument type

src

array<auto(TT)> const

Sums elements in an array

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

average returns TT

argument

argument type

src

iterator<auto(TT)>

Averages elements in an array

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

average returns TT

argument

argument type

src

array<auto(TT)> const

Averages elements in an array

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

min_max_average returns tuple<TT;TT;TT>

argument

argument type

src

iterator<auto(TT)>

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

min_max_average(src: array<auto(TT)> const)

min_max_average returns tuple<TT;TT;TT>

argument

argument type

src

array<auto(TT)> const

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

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

min_max_average_by returns tuple<TT;TT;TT>

argument

argument type

src

iterator<auto(TT)>

key

auto const

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

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

min_max_average_by returns tuple<TT;TT;TT>

argument

argument type

src

array<auto(TT)> const

key

auto const

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

56.6. Filtering data

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

where_ returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

Filters elements in an array based on a predicate

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

where_ returns array<TT>

argument

argument type

src

array<auto(TT)> const

predicate

block<(arg:TT const):bool> const

Filters elements in an array based on a predicate

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

where_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

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

56.7. Partitioning data

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

skip returns array<TT>

argument

argument type

arr

array<auto(TT)> const

total

int

Yields all but the first total elements

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

skip_inplace returns auto

argument

argument type

arr

array<auto(TT)>

total

int

Removes the first total elements from an array in place

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

skip returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

total

int

Yields all but the first total elements

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

skip_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

total

int

Yields all but the first total elements and returns an array

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

skip_while returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

Skips all elements of an array while the predicate is true

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

skip_while returns array<TT>

argument

argument type

src

array<auto(TT)> const

predicate

block<(arg:TT const):bool> const

Skips all elements of an array while the predicate is true

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

skip_while_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

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

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

take returns array<TT>

argument

argument type

arr

array<auto(TT)> const

total

int

Yields a range of elements from an array

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

take_inplace returns auto

argument

argument type

arr

array<auto(TT)>

total

int

Keeps only a range of elements in an array in place

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

take returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

total

int

Yields a range of elements from an array

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

take_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

total

int

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

take(src: iterator<auto(TT)>; from: range const)

take returns iterator<TT>

argument

argument type

src

iterator<auto(TT)>

from

range const

Yields a range of elements from an array

take(src: array<auto(TT)> const; from: range const)

take returns array<TT>

argument

argument type

src

array<auto(TT)> const

from

range const

Yields a range of elements from an array

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

take_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

from

range const

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

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

take_inplace returns auto

argument

argument type

arr

array<auto(TT)>

from

range const

Keeps only a range of elements in an array in place

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

take_while returns auto

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

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

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

take_while returns array<TT>

argument

argument type

src

array<auto(TT)> const

predicate

block<(arg:TT const):bool> const

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

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

take_while_to_array returns array<TT>

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

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

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

chunk returns array<array<TT>>

argument

argument type

src

array<auto(TT)> const

size

int const

Splits an iterator into chunks of a specified size

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

chunk_to_array returns array<array<TT>>

argument

argument type

src

iterator<auto(TT)>

size

int const

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

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

chunk returns iterator<array<TT>>

argument

argument type

src

iterator<auto(TT)>

size

int const

Splits an iterator into chunks of a specified size

56.8. Join and group operations

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

join returns iterator<typedecl>

argument

argument type

srca

iterator<auto(TA)>

srcb

iterator<auto(TB)>

keya

auto const

keyb

auto const

result

auto const

Joins two arrays based on matching keys (inner join)

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

join returns array<typedecl>

argument

argument type

srca

array<auto(TA)> const

srcb

array<auto(TB)> const

keya

auto const

keyb

auto const

result

auto const

Joins two arrays based on matching keys (inner join)

join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto const; keyb: auto const; result: auto const)

join_to_array returns array<typedecl>

argument

argument type

srca

iterator<auto(TA)>

srcb

iterator<auto(TB)>

keya

auto const

keyb

auto const

result

auto const

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

group_join(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto const; keyb: auto const; result: auto const)

group_join returns iterator<typedecl>

argument

argument type

srca

iterator<auto(TA)>

srcb

iterator<auto(TB)>

keya

auto const

keyb

auto const

result

auto const

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

group_join(srca: array<auto(TA)> const; srcb: array<auto(TB)> const; keya: auto const; keyb: auto const; result: auto const)

group_join returns array<typedecl>

argument

argument type

srca

array<auto(TA)> const

srcb

array<auto(TB)> const

keya

auto const

keyb

auto const

result

auto const

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

group_join_to_array(srca: iterator<auto(TA)>; srcb: iterator<auto(TB)>; keya: auto const; keyb: auto const; result: auto const)

group_join_to_array returns array<typedecl>

argument

argument type

srca

iterator<auto(TA)>

srcb

iterator<auto(TB)>

keya

auto const

keyb

auto const

result

auto const

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

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

group_by returns auto

argument

argument type

source

iterator<auto(TT)>

key

auto const

element_selector

auto const

result_selector

auto const

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

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

group_by returns auto

argument

argument type

source

array<auto(TT)> const

key

auto const

element_selector

auto const

result_selector

auto const

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

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

group_by_to_array returns auto

argument

argument type

source

iterator<auto(TT)>

key

auto const

element_selector

auto const

result_selector

auto const

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

56.9. Querying data

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

any returns bool

argument

argument type

src

array<auto(TT)> const

Returns true if any element in the array satisfies the predicate

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

any returns bool

argument

argument type

src

iterator<auto(TT)>

Returns true if any element in the array satisfies the predicate

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

any returns bool

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

Returns true if any element in the array satisfies the predicate

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

any returns bool

argument

argument type

src

array<auto(TT)> const

predicate

block<(arg:TT const):bool> const

Returns true if any element in the array satisfies the predicate

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

all returns bool

argument

argument type

src

iterator<auto(TT)>

predicate

block<(arg:TT const):bool> const

Returns true if all elements in the array satisfy the predicate

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

all returns bool

argument

argument type

src

array<auto(TT)> const

predicate

block<(arg:TT const):bool> const

Returns true if all elements in the array satisfy the predicate

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

contains returns bool

argument

argument type

src

iterator<auto(TT)>

element

TT const

Returns true if the element is present in the array

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

contains returns bool

argument

argument type

src

array<auto(TT)> const

element

TT const

Returns true if the element is present in the array

56.10. Element operations

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

element_at returns TT

argument

argument type

src

array<auto(TT)> const

index

int const

Returns the element at the specified index

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

element_at returns TT

argument

argument type

src

iterator<auto(TT)>

index

int const

Returns the element at the specified index

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

element_at_or_default returns TT

argument

argument type

src

array<auto(TT)> const

index

int const

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

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

element_at_or_default returns TT

argument

argument type

src

iterator<auto(TT)>

index

int const

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

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

first returns TT

argument

argument type

src

array<auto(TT)> const

Returns the first element of an iterator

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

first returns TT

argument

argument type

src

iterator<auto(TT)>

Returns the first element of an iterator

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

first_or_default returns TT

argument

argument type

src

array<auto(TT)> const

defaultValue

TT const

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

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

first_or_default returns TT

argument

argument type

src

iterator<auto(TT)>

defaultValue

TT const

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

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

last returns TT

argument

argument type

src

array<auto(TT)> const

Returns the last element of an iterator

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

last returns TT

argument

argument type

src

iterator<auto(TT)>

Returns the last element of an iterator

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

last_or_default returns TT

argument

argument type

src

array<auto(TT)> const

defaultValue

TT const

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

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

last_or_default returns TT

argument

argument type

src

iterator<auto(TT)>

defaultValue

TT const

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

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

single returns TT

argument

argument type

src

array<auto(TT)> const

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

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

single returns TT

argument

argument type

src

iterator<auto(TT)>

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

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

single_or_default returns TT

argument

argument type

src

array<auto(TT)> const

defaultValue

TT const

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

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

single_or_default returns TT

argument

argument type

src

iterator<auto(TT)>

defaultValue

TT const

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

56.11. Transform operations

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

select returns iterator<tuple<int;TT>>

argument

argument type

src

iterator<auto(TT)>

Projects each element of an array into a new form

select(src: array<auto(TT)> const)

select returns array<tuple<int;TT>>

argument

argument type

src

array<auto(TT)> const

Projects each element of an array into a new form

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

select_to_array returns array<tuple<int;TT>>

argument

argument type

src

iterator<auto(TT)>

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

select(src: iterator<auto(TT)>; result_selector: auto const)

select returns iterator<typedecl>

argument

argument type

src

iterator<auto(TT)>

result_selector

auto const

Projects each element of an array into a new form

select(src: array<auto(TT)> const; result_selector: auto const)

select returns array<typedecl>

argument

argument type

src

array<auto(TT)> const

result_selector

auto const

Projects each element of an array into a new form

select_to_array(src: iterator<auto(TT)>; result_selector: auto const)

select_to_array returns array<typedecl>

argument

argument type

src

iterator<auto(TT)>

result_selector

auto const

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

select_many(src: iterator<auto(TT)>; result_selector: auto const)

select_many returns iterator<typedecl>

argument

argument type

src

iterator<auto(TT)>

result_selector

auto const

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

select_many(src: array<auto(TT)> const; result_selector: auto const)

select_many returns array<typedecl>

argument

argument type

src

array<auto(TT)> const

result_selector

auto const

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

select_many_to_array(src: iterator<auto(TT)>; result_selector: auto const)

select_many_to_array returns array<typedecl>

argument

argument type

src

iterator<auto(TT)>

result_selector

auto const

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

select_many(src: iterator<auto(TT)>; collection_selector: auto const; result_selector: auto const)

select_many returns iterator<typedecl>

argument

argument type

src

iterator<auto(TT)>

collection_selector

auto const

result_selector

auto const

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

select_many(src: array<auto(TT)> const; collection_selector: auto const; result_selector: auto const)

select_many returns array<typedecl>

argument

argument type

src

array<auto(TT)> const

collection_selector

auto const

result_selector

auto const

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

select_many_to_array(src: iterator<auto(TT)>; collection_selector: auto const; result_selector: auto const)

select_many_to_array returns array<typedecl>

argument

argument type

src

iterator<auto(TT)>

collection_selector

auto const

result_selector

auto const

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

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

zip returns iterator<tuple<TT;UU>>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(UU)>

Merges two arrays into an array by applying a specified function

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

zip returns array<tuple<TT;UU>>

argument

argument type

a

array<auto(TT)> const

b

array<auto(UU)> const

Merges two arrays into an array by applying a specified function

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

zip_to_array returns array<tuple<TT;UU>>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(UU)>

Merges two iterators into an array by applying a specified function

zip(a: iterator<auto(TT)>; b: iterator<auto(UU)>; result_selector: block<(l:TT const;r:UU const):auto> const)

zip returns iterator<typedecl>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(UU)>

result_selector

block<(l:TT const;r:UU const):auto> const

Merges two arrays into an array by applying a specified function

zip(a: array<auto(TT)> const; b: array<auto(UU)> const; result_selector: block<(l:TT const;r:UU const):auto> const)

zip returns array<typedecl>

argument

argument type

a

array<auto(TT)> const

b

array<auto(UU)> const

result_selector

block<(l:TT const;r:UU const):auto> const

Merges two arrays into an array by applying a specified function

zip_to_array(a: iterator<auto(TT)>; b: iterator<auto(UU)>; result_selector: block<(l:TT const;r:UU const):auto> const)

zip_to_array returns array<typedecl>

argument

argument type

a

iterator<auto(TT)>

b

iterator<auto(UU)>

result_selector

block<(l:TT const;r:UU const):auto> const

Merges two iterators into an array by applying a specified function

56.12. Convertion operations

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

to_sequence returns iterator<TT>

argument

argument type

a

array<auto(TT)> const

Converts an array to an iterator

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

to_sequence_move returns iterator<TT>

argument

argument type

a

array<auto(TT)>

Converts an array to an iterator, captures input

to_table(a: iterator<auto(TT)>; key: block<(v:TT const):auto> const; elementSelector: block<(v:TT const):auto> const)

to_table returns table<typedecl;typedecl>

argument

argument type

a

iterator<auto(TT)>

key

block<(v:TT const):auto> const

elementSelector

block<(v:TT const):auto> const

Converts an array to a table

to_table(a: array<auto(TT)> const; key: block<(v:TT const):auto> const; elementSelector: block<(v:TT const):auto> const)

to_table returns table<typedecl;typedecl>

argument

argument type

a

array<auto(TT)> const

key

block<(v:TT const):auto> const

elementSelector

block<(v:TT const):auto> const

Converts an array to a table

56.13. Comparators and keys

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

less returns bool

argument

argument type

a

auto const

b

auto const

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

less(a: tuple<auto(TT)> const; b: tuple<auto(TT)> const)

less returns bool

argument

argument type

a

tuple<auto(TT)> const

b

tuple<auto(TT)> const

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

less(a: tuple<auto(TT);auto(UU)> const; b: tuple<auto(TT);auto(UU)> const)

less returns bool

argument

argument type

a

tuple<auto(TT);auto(UU)> const

b

tuple<auto(TT);auto(UU)> const

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

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

less returns bool

argument

argument type

a

tuple<auto(TT);auto(UU);auto(VV)> const

b

tuple<auto(TT);auto(UU);auto(VV)> const

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

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

less returns bool

argument

argument type

a

tuple<auto(TT);auto(UU);auto(VV);auto(WW)> const

b

tuple<auto(TT);auto(UU);auto(VV);auto(WW)> const

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

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

sequence_equal returns bool

argument

argument type

first

iterator<auto(TT)>

second

iterator<auto(TT)>

Checks if two arrays are equal

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

sequence_equal returns bool

argument

argument type

first

array<auto(TT)> const

second

array<auto(TT)> const

Checks if two arrays are equal

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

sequence_equal_by returns bool

argument

argument type

first

iterator<auto(TT)>

second

iterator<auto(TT)>

key

block<(arg:TT const):auto> const

Checks if two arrays are equal by key

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

sequence_equal_by returns bool

argument

argument type

first

array<auto(TT)> const

second

array<auto(TT)> const

key

block<(arg:TT const):auto> const

Checks if two arrays are equal by key