oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.83k stars 155 forks source link

More concurrency constructs (xargs, gnu parallel, nonlinear pipelines) #843

Open andychu opened 3 years ago

andychu commented 3 years ago

We have a nascent xargs here:

https://github.com/oilshell/oil/tree/master/tools

I mentioned xargs here:

http://www.oilshell.org/blog/2020/02/good-parts-sketch.html#the-0-dispatch-pattern-solves-three-important-problems

and it's hidden in the help as each:

https://www.oilshell.org/release/0.8.3/doc/oil-help-topics.html#builtin

andychu commented 3 years ago

Basically I want us to have something like:

find --qtsv . | each {
  echo "$name --- $size"
}
andychu commented 3 years ago

Also, with Oil blocks, I imagine instead of

diff <(sort left.txt) <(sort right.txt)

You could factor it out like:

var p1 = &(sort left.txt) 
var p2 = &(sort right.txt)

diff $stdout(p1) $stdout(p2)
andychu commented 3 years ago

Random idea here: https://news.ycombinator.com/item?id=25939152

grep FOO *.py | wc -l | sort -n

pipeline {
  pipe :p1  # variables that are pipes
  pipe :p2

  # this syntax isn't great but shows the idea
  grep FOO *.py > &p1
  < &p1 wc -l > &p2
  < &p2 sort -n
}