# lambda

### lambda

lambda functions are nameless function. lambda functions are usually one line functions. lambda functions are usually used as input parameter to map and filter function.

For example:

Make every element of list \[1,2,3,4,5] square

```
list(map(lambda x: x**2,[1,2,3,4,5]))
```

Output:

\[1, 4, 9, 16, 25]

Filter out odd element, only keep even element of a list

```
list(filter(lambda x: x%2==0, [1,2,3,4,5]))
```

It output below:

\[2,4]


---

# Agent Instructions: 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:

```
GET https://george-jen.gitbook.io/data-science-and-apache-spark/lambda.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
