Columnal Documentation: Table of Contents

listprocess functions

anyallnonecombineselectapply eachcount wherelist contains
any(list, test)any pass test Type: For any types t([t], (t) -> Boolean) -> Boolean

Returns true if the given function returns true for any item in the list.

If the list is empty, returns false.

ExamplesClick an example to insert it
any(["a", "b", "c"], (? = "b"))true
any([0, 1, 2, 3], (? > 5))false
any([], (? = 0))false
all(list, test)all pass test Type: For any types t([t], (t) -> Boolean) -> Boolean

Returns true if the given function returns true for all items in the list.

If the list is empty, returns true.

ExamplesClick an example to insert it
all([0, 1, 2, 3], (? < 5))true
all(["a", "b", "c"], (? = "b"))false
all([], (? = 0))true
none(list, test)none pass test Type: For any types t([t], (t) -> Boolean) -> Boolean

Returns true if the given function returns true for no items in the list.

If the list is empty, returns true.

ExamplesClick an example to insert it
none([0, 1, 2, 3], (? > 5))true
none(["a", "b", "c"], (? = "b"))false
none([], (? = 0))true
combine(items, combining function)combined Type: For any types t([t], (t, t) -> t) -> t

Collapses the list into a single item by combining the elements using the given function.

ExamplesClick an example to insert it
combine([1, 2, 3], (? + ?))6
combine(["a", "b", "c"], (? ; ?))"abc"
combine([true, false, false, true], (? | ?))true
combine([], (? + ?))error
select(list, test)items passing test Type: For any types t([t], (t) -> Boolean) -> [t]

Returns a new list containing all the items in the list for which the function returns true.

ExamplesClick an example to insert it
select([3, 8, 4, 6, 2], (? >= 5))[8, 6]
select([], (? = 0))[]
apply each(list, transform function)transformed list Type: For any types before, after([before], (before) -> after) -> [after]

Applies the function to each item in the list, and returns the resulting items.

The order of the items in the new list will correspond to the original order.

ExamplesClick an example to insert it
apply each([3, 6, 9], (? + 1))[4, 7, 10]
apply each([-3, 4, -7], abs)[3, 4, 7]
count where(list, test)count Type: For any types t([t], (t) -> Boolean) -> Number

Counts the number of items in the list where the given test function returns true.

ExamplesClick an example to insert it
count where([11, -2, 14, 4, 0], (? > 10))2
count where(["Hi", "Hello"], (? = "Bye"))0
list contains(list, item)is in list Type: For any types t where Equatable t([t], t) -> Boolean

Checks if the item is in the list.

ExamplesClick an example to insert it
list contains([1, 2, 3], 2)true
list contains(["a", "b", "c"], "d")false