Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FWIW, one of the reasons I made https://oilshell.org sh-compatible is because it already has a very elegant answer to this problem:

Pipelines Support Vectorized, Point-Free, and Imperative Style

http://www.oilshell.org/blog/2017/01/15.html

You just do

    myls() { ls -la | lines ... ; }
    my ls | awk '$1 > 1000'
That is, a function can be TRANSPARENTLY put in a pipeline. Shell functions have stdin and stdout that compose.

The awk part isn't ideal, but I have some plans to fix that:

http://www.oilshell.org/blog/tags.html?tag=awk#awk

https://github.com/oilshell/oil/wiki/Structured-Data-in-Oil



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: