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])In the solver,
Open in the solverapply(plus, [1, 2, 3])gives6.
Related functions
- 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.