# intertools

Starlark module for working with iterators library.

This module implements a number of iterator building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a form suitable for Python. The module standardizes a core set of fast, memory efficient tools that are useful by themselves or in combination. Together, they form an “iterator algebra” making it possible to construct specialized tools succinctly and efficiently in pure Python.

Similar to [itertools in Python](https://docs.python.org/3/library/itertools.html).

## itertools.chain(\*iterables)

Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence.

Example:

```python
chain(['ABC', 'DEF'], ['GHI'])
['ABC', 'DEF', 'GHI']
```

**Parameters:**

**iterables** - iterables to chain.

*Returns:* new iterable, that contains content of iterables.

## itertools.from\_iterable(iterables)

Alternate constructor for chain(). Gets chained inputs from a single iterable argument that is evaluated lazily. Same as chain()

**Parameters:**

**iterables** - iterables to chain.

*Returns:* new iterable, that contains content of iterables.


---

# 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://docs.verygoodsecurity.com/vault/developer-tools/larky/library-api/itertools.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.
