Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Anonymous function (function)

A function with no name; also written x => body.

How to write it

function(parameters, body)

parameters
The parameter, or a list of parameters in brackets. Takes a variable, or a list of variables.
body
The expression to evaluate. Takes an expression.

Examples

  • (x↦x2)(3)=9\displaystyle (x \mapsto x^{2})(3) = 9
    (x => x^2)(3)

    In the solver, (x => x^2)(3) gives 9.

    Open in the solver
  • ifelse

    A value chosen by a test.

  • evaluate

    Evaluate an expression even where it would be held.

  • increment

    Add 1 to a variable in place and return its old value.

  • divide_by

    Divide a variable by a value in place and return the new value.

  • indicator

    A condition as a number: 1 when it is true and 0 when it is false.

  • decrement

    Subtract 1 from a variable in place and return its old value.