Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

apply function

Replace the head of an expression, or the brackets of a list, with a function.

How to write it

apply(f, expr)

f
The function to put in place of the head. Takes a function.
expr
Any expression: a number, a formula, a list or a matrix. Takes an expression.

Examples

  • apply⁡(plus⁡,[1,2,3])=6\displaystyle \operatorname{apply}(\operatorname{plus}, \left[ 1, 2, 3 \right]) = 6
    apply(plus, [1, 2, 3])

    In the solver, apply(plus, [1, 2, 3]) gives 6.

    Open in the solver
  • complement

    The elements of a list that are in none of the others.

  • append

    A list with an element added at the end.

  • constant_array

    A list of copies of a value.

  • accumulate

    Running totals of a list.

  • count

    How many elements of a list equal a value.

  • union

    The elements in any of some lists, each once, in order.