> For the complete documentation index, see [llms.txt](https://docs.atfinity.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atfinity.io/rule-language/operators/list-operators/map.md).

# map()

### Description

`map()` is used to perform the same action on each individual value in a list.

That way, it lets you transform a list of values into another list, which comes in especially handy when working with user-provided values like `nationalities` or `sources_of_income`.

Also see [MAP](/rule-language/operators/list-operators/map-1.md) for a non-method version.

### Example: Double some numbers

```
SUM(
  [1, 2, 3].map(number => number * 2)
)
```

* We call map on a list, here the list of numbers `[1, 2, 3]`.
* The argument within map is the function we use on each element, here `number * 2`. It takes each number from that array and multiplies it by 2. With each calculation, the variable `number` is replaced by the next value from the list, until the last value has been dealt with. We chose the name to be `number` as the variable before `=>`. We could have also chosen `n` or `x` if we would have wanted to.
* Since a SUM operator encloses the MAP function, the final output will be the added total of all doubled values - in this case: 12.

The calculations step-by-step:

* 1 \* 2 = 2
* 2 \* 2 = 4
* 3 \* 2 = 6
* The intermediate result of MAP is the new list \[2, 4, 6]
* SUM adds these new values: 2 + 4 + 6 = 12.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/list-operators/map.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
