Read from stdin
Closed this issue · 1 comments
Tarrasch commented
If no arguments are given it would be nice if the function just assumed it should read form stdin. Like this
$ echo 1 2 3 4 5 | mapa '3*$1' | filtera '$1%2 == 0' | folda '$1+$2' 0
27
(3+9+15 = 27)
Tarrasch commented
Another use case I just thought of is the desired laziness. Like now you can only combine these function by passing arguments with $(command)
, for instance
mapa '$1/2' $(each 'heavy-function $1' {1..15})
But that will be strict in the second argument to mapa
because the shell arguments are inherently strict. The file descriptors are not though, so that's why I highly value reading from stdin.
Furthermore, the $()
will mess up the syntax highligthing I have in zsh.