Metadata-Version: 2.1
Name: f-it
Version: 0.3.0
Summary: Iterator class for functional programming
Home-page: https://github.com/clbarnes/f_it
Author: Chris L. Barnes
Author-email: chrislloydbarnes@gmail.com
License: MIT license
Keywords: f_it
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Provides-Extra: all

=========================
f_it: Functional Iterator
=========================


.. image:: https://img.shields.io/pypi/pyversions/f_it.svg
        :target: https://pypi.python.org/pypi/f_it

.. image:: https://img.shields.io/pypi/v/f_it.svg
        :target: https://pypi.python.org/pypi/f_it

.. image:: https://img.shields.io/travis/clbarnes/f_it.svg
        :target: https://travis-ci.org/clbarnes/f_it

.. image:: https://readthedocs.org/projects/f_it/badge/?version=latest
        :target: https://f_it.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/ambv/black

Iterator class for functional programming in python

* Free software: MIT license
* Documentation: https://f_it.readthedocs.io.

Features
--------

* A single wrapper class exposing chain-able methods for lazily transforming iterators
* Wraps functions from ``functools``, ``itertools``, and some extras
* Optionally has a length, which is calculated for subsequent operations if possible

Note that this package is for convenience/ interface comfort purposes
and does not provide the guarantees of a true functional language.
There may be a significant performance overhead to using deeply nested ``FIt`` instances in tight loops.

Install
-------

``pip install f_it``

Usage
-----

.. code-block:: python

    from f_it import FIt

    it = FIt(range(10))
    transformed = it.map(  # cube elements
        lambda x: x**3
    ).filter(  # drop even elements
        lambda x: x % 2
    ).cycle(  # repeat the whole iterator 3 times
        3
    ).islice(  # take some elements from the middle
        5, 10
    ).chain(  # add 0-4 to the end
        range(5)
    ).chunk(  # separate into 2-length chunks
        2
    )

    # __add__ and __radd__ are implemented for chaining other Iterators
    added = transformed + iter([1, 2, 3])

    # nothing has been evaluated yet!

    # evaluate operations, reading into a list
    # if tqdm is available, show progress bar
    as_list = added.progress().to(list)


=======
History
=======

0.3.0 (2020-09-03)
------------------

* Implement ``__add__`` and ``__radd__``

0.1.0 (2019-08-21)
------------------

* First release on PyPI.


