---
title: LAMBDA
url: https://www.tines.com/docs/formulas/functions/lambda/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# LAMBDA

*[View on tines.com](https://www.tines.com/docs/formulas/functions/lambda/)*

Creates a custom, reusable function.

The last argument is the calculation you want to perform, all previous arguments are the parameters for this calculation

**Categories:** Lambdas

## Syntax

```
LAMBDA([parameter1, parameter2, …,] calculation)
```

## Examples

### Example 1: Select all the elements in an array that regex match the string "r"​

Input:

```json
{
  "my_array": [
    "red",
    "blue",
    "green"
  ]
}
```

Formula:

```
FILTER(input.my_array, LAMBDA(element, MATCH(element, "r")))
```

Output:

```json
[
  "red",
  "green"
]
```

### Example 2: Get the difference between 2 arrays, i.e. get elements from array_two that are not present in array_one​

Input:

```json
{
  "array_one": [
    "dog",
    "cat",
    "turtle",
    "dinosaur",
    "lizard",
    "chicken",
    "koala"
  ],
  "array_two": [
    "cat",
    "elephant",
    "giraffe",
    "penguin",
    "tiger",
    "koala"
  ]
}
```

Formula:

```
FILTER(input.array_two, LAMBDA(array_two_elem, NOT(INCLUDES(input.array_one, array_two_elem))))
```

Output:

```json
[
  "elephant",
  "giraffe",
  "penguin",
  "tiger"
]
```

## Sample actions

### Sample action 1

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "array": [
            "red",
            "blue",
            "green"
          ]
        }
      },
      "position": {
        "x": 2910,
        "y": 2895
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "LAMBDA",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "lambda": "=FILTER(my_action.array, LAMBDA(element, MATCH(element, \"r\")))"
        }
      },
      "position": {
        "x": 2910,
        "y": 3000
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```

### Sample action 2

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "array_one": [
            "dog",
            "cat",
            "turtle",
            "dinosaur",
            "lizard",
            "chicken",
            "koala"
          ],
          "array_two": [
            "cat",
            "elephant",
            "giraffe",
            "penguin",
            "tiger",
            "koala"
          ]
        }
      },
      "position": {
        "x": 3090,
        "y": 2895
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "LAMBDA",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "lambda": "=FILTER(my_action.array_two, LAMBDA(array_two_elem, NOT(INCLUDES(my_action.array_one, array_two_elem))))\n"
        }
      },
      "position": {
        "x": 3090,
        "y": 3000
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
