Metadata-Version: 2.0
Name: funcipy
Version: 0.3
Summary: A library to inject common functional programming operations as methods into iterable objects.
Home-page: https://bitbucket.org/rvprasad/funcipy
Author: Venkatesh-Prasad Ranganath
Author-email: UNKNOWN
License: BSD 3-Clause License
Download-URL: https://bitbucket.org/rvprasad/funcipy/downloads/?tab=tags
Description-Content-Type: UNKNOWN
Keywords: functional,programming
Platform: unix
Platform: linux
Platform: osx
Platform: cygwin
Platform: win32
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6

funcipy
=======

A library to inject common functional programming operations as methods
into iterable objects. Currently, it injects
``filter, foldl, foldr, map,`` and ``reduce`` operations.

Getting the library
-------------------

The library can be installed via ``pip install funcipy``. Similarly, it
can be uninstalled via ``pip uninstall funcipy``.

Usage
-----

When you want to inject common functional programming operations as
methods into an object *O*, invoke ``funcipy.funcipy.funcify`` function
with *O* as the argument. If *O* is iterable, then the function will
return an object that

1. provides the same interface as the input object and
2. has functional programming operations as methods.

Otherwise, *O* is returned as is.

Here are few example invocations.

.. code:: python

    from funcipy.funcipy import funcify
    import functools
    import operator

    i = range(1, 10)
    print("Map function: " + ' '.join(map(str, i)))
    tmp1 = funcify(i)
    print("Map function applied to funcified object: " + ' '.join(map(str, tmp1)))
    print("Map method: " + ' '.join(tmp1.map(str)))
    print("Map and Filter Method chaining: " +
          ' '.join(tmp1.filter(lambda x: x % 2).map(str)))
    print("Reduce function: " + str(functools.reduce(operator.add, i, 5)))
    print("Reduce method: " + str(tmp1.reduce(operator.add, 5)))
    print("Reduce function: " + str(functools.reduce(operator.sub, i)))
    print("Foldl method: " + str(tmp1.foldl(operator.sub)))
    print("Foldr method: " + str(tmp1.foldr(operator.sub)))

Attribution
-----------

Copyright (c) 2017, Venkatesh-Prasad Ranganath

Licensed under BSD 3-clause "New" or "Revised" License
(https://choosealicense.com/licenses/bsd-3-clause/)

**Authors:** Venkatesh-Prasad Ranganath


