4 ms·
I have built something similar, coming at the problem from a different direction. I wanted a Unix-style shell, but piping objects instead of strings. For exampl
by geophile 16y ago
I have built something similar, coming at the problem from a different direction. I wanted a Unix-style shell, but piping objects instead of strings. For example, to sum x^2 from the command line, x = 0-9:
bash$ osh gen 10 ^ f 'x: x**2' ^ red + $
^ is the pipe symbol, red means "reduce", $ means output, and f means apply the given function.
The same capabilities are available as a Python library:
from osh.api import *
osh(gen(10), f(lambda x: x**2), red(lambda x, y: x + y), out())
or
from osh.api import *
osh(gen(10), f(lambda x: x**2), red('+'), out())
Osh can also run results on multiple hosts at once, in parallel, combining the results in various ways; and integrates database access, piping tuples to and from sql commands.
http://geophile.com/osh http://geophile.com/osh
- iki23 16y agoNice! Would deserve a github repository and keeping the pypi pakcage up-to-date: http://pypi.python.org/pypi/osh/ http://pypi.python.org/pypi/osh/
- geophile 16y agoYes, the pypi entry is obsolete. For some reason, I get into some sort of endless lost username/password purgatory whenever I try to register there. I really should bring that up to date and put the package in github.