A library to inject common functional programming operations as methods into iterable objects.
Project description
A library to inject common functional programming operations as methods into iterable objects. Currently, it supports map operation.
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
provides the same interface as the input object and
has functional programming operations as methods.
Otherwise, O is returned as is.
Here are few example invocations.
from funcipy.funcipy import funcify
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 method chaining: " + ' '.join(tmp1.map(str).map(lambda x: x * 2)))
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for funcipy-0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4d2f1b2c72f45ea156896191bf2164e454433dc28d5c20324c6a2c5c2dd7ba1 |
|
MD5 | 953fee9801e6f97e6b306a95a4cab43e |
|
BLAKE2b-256 | 5b0d8c60ebb31e5a0745eaedd06bf397eaeee0dd686671d76cde5d208dd757a1 |