Is there any functional-like unix shell?
- by Caruccio
I'm (really) newbie to functional programming (in fact only had contact with it using python) but seems to be a good approach for some list-intensive tasks in a shell environment.
I'd love to do something like this:
$ [ git clone $host/$repo for repo in repo1 repo2 repo3 ]
Is there any Unix shell with these kind of feature?
Or maybe some feature to allow easy shell access (commands, env/vars, readline, etc...) from within python (the idea is to use python's interactive interpreter as a replacement to bash).
EDIT:
Maybe a comparative example would clarify.
Let's say I have a list composed of dir/file:
$ FILES=( build/project.rpm build/project.src.rpm )
And I want to do a really simple task: copy all files to dist/ AND install it in the system (it's part of a build process):
Using bash:
$ cp ${files[*]} dist/
$ cd dist && rpm -Uvh $(for f in ${files[*]}; do basename $f; done))
Using a "pythonic shell" approach (caution: this is imaginary code):
$ cp [ os.path.join('dist', os.path.basename(file)) for file in FILES ] 'dist'
Can you see the difference ?
THAT is what i'm talking about. How can not exits a shell with these kind of stuff build-in yet? It's a real pain to handle lists in shell, even its being a so common task: list of files, list of PIDs, list of everything.
And a really, really, important point: using syntax/tools/features everybody already knows: sh and python.
IPython seams to be on a good direction, but it's bloated: if var name starts with '$', it does this, if '$$' it does that. It's syntax is not "natural", so many rules and "workarounds" ([ ln.upper() for ln in !ls ] -- syntax error)