Skip to content

apply

Syntax

apply(list-expression, pair-expression)

Parameters

list-expression
An expression that evaluates to a list of numeric values.
pair-expression
An expression which is applied using each numeric value from the list.

Returns

Returns a list of the same length as the given list-expression, where each entry in the list is formed by applying the corresponding value in the list to the given pair-expression.

Description

This action returns a list of values evaluated using a given expression. The first argument specifies the list of values to apply using the expression in the second argument.

In the expression to evaluate, the special variable "[_]{.title-ref}" is a place-holder for the values applied from the given list-expression.

Examples

The following example returns a list with values twice the size of the input list:

apply(distance_list, 2 * _)

For example:

distance_list = list(10, 20, 30, 50)
roundtrip_list = apply(distance_list, 2 * _)

After this example, roundtrip_list would hold the list (20, 40, 60, 100).

See Also