Data Source ->Pipe -----> Filter ----->Filter --------->DataSink
| ^
| |
| |
->---------Filter--------------^
So in Perl list context gives the ability as with Unix pipes to pass from one filter to the next, but the list is completed before it goes on to the next stage, there is no concurrency, right? Even though it seems like there should be. Trying to find a good example: map { $_^2 } grep { isPrime($_) } grep processes the whole list before map processes the first element? Why?
I guess the equivalent Perl5 is to create an iterator and threads and one thread pushes onto the queue and another one takes off the queue? So you have essentially a bucket brigade of threads. Each thread performs a filtering process and passes on to the next filter. So what is the approach to scale this idea so that each filter can be replaced / modified / added / deleted?
I found this paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3534.html And also the Perl6 Documentation (sorry) talks about concurrency - http://doc.perl6.org/language/concurrency as in the language itself supports this paradigm of programming with Promises and Supplies -- maybe. Is there some kind of equivalent feature in Perl 5? Maybe this: https://github.com/skaji/Process-Pipeline
Basically map and grep but acting in parallel, asynchronously, rather than in sequence.