This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
 ___
|  _|_ _
|  _|_'_|
|_| |_,_|igher-order function coding.

Introduction

TL;DR - YAGNI.

Inspired by Haskell’s rich set of operators, this is an approach to functional programming with operators in Python.

“It’s fun… It’s insane… It’s insanely fun.”

—John Doe

Features

  • Currying functions with <<, &
  • Piping output of functions with |
  • Composing functions with **
  • Flipping order of arguments of function with ~
  • and more

Examples

>>> from fx import f
>>> double_all = f(map) << 2 .__mul__ | list
>>> double_all([1, 2, 3])
[2, 4, 6]
>>> double_all |= f(map) << str | ' '.join
>>> double_all([1, 2, 3])
'2 4 6'
>>> sum_upto = 1 .__add__ | f(range) << 1 | sum
>>> sum_upto(100)
5050
>>> parse_hex_str = ~f(int) << 16
>>> parse_hex_str('ff')
255
>>> parse_hex_str('c0ffee')
12648430
>>> # project euler problem 1
>>> euler_p1 = f(range) << 1 | f(filter) << (lambda n: n % 3 == 0 or n % 5 == 0) | sum
>>> euler_p1(10)
23
>>> euler_p1(1000)
233168
>>> # project euler problem 20
>>> fact = f(lambda n: 1 if n == 1 else n * fact(n - 1))
>>> euler_p20 = str ** fact | sum ** f(map) << int
>>> euler_p20(10)
27
>>> euler_p20(100)
648

Requirements

  • CPython >= 2.6

Installation

Install from PyPI:

pip install fx

Install from source, download source package, decompress, then cd into source directory, run:

make install

License

BSD New, see LICENSE for details.

Release History

Release History

0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1-dev

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fx-0.3.tar.gz (19.3 kB) Copy SHA256 Checksum SHA256 Source Jun 15, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting