Skip to content

The package provides a pipe operator to stitch together workflows composed out of ordinary python functions.

Notifications You must be signed in to change notification settings

jamitzky/magrittpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

magrittpy

The package provides a pipe operator to stitch together workflows composed out of ordinary python functions. It is inspired by the magrittR package from R.

Installation

pip install git+https://github.com/jamitzky/magrittpy

Basic usage

sum_of_lists = forall(x=list1, y=list2) >> flatmap(lambda x,y: x+y) >> sum >> result

It consists of the two basic classes (which are used as keywords here) forall and result. The right-shift operator is overloaded so that functions can be stitched together into a workflow. Additionally adverbs can be definied which act as decorators and provide monad like features like map-reduce.

The package also provides a fork-like syntax like in J for dyads:

(sum |div| len) == lambda x:sum(x)/len(x)

which can be used inside the workflow:

forall(10) >> range >> (sum|div|len) >> result

About

The package provides a pipe operator to stitch together workflows composed out of ordinary python functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages