Logo LightLogo Dark

Iterex

Elixir CILicense: MITHex version badge

Iterex is a library that provides external iterators for Elixir collections.

Iterators provide the flexibility of Enum with the laziness of Stream and the ability to pause and resume iteration.

The Iter module provides the public interface to working with iterators, which wraps an Iter.Iterable (to make it easier to pattern match, etc). You'll find most of the functions you'd want from Stream and Enum provided by this module, but often with different return values to enable you to resume iteration where possible. The Enumerable and Collectable protocols have been implemented for Iter so you can use them as drop in replacements for other collection types where needed.

Some differences from Enum and Stream:

See the documentation on hexdocs for more information.

Sponsors

Thanks to Alembic Pty Ltd for sponsoring a portion of this project's development.

Installation

The package can be installed by adding iterex to your list of dependencies in mix.exs:

def deps do
  [
    {:iterex, "~> 0.1.2"}
  ]
end

Contributing

Licence

iterex is licensed under the terms of the MIT license. See the LICENSE file in this repository for details.