Perl 6 Parallelism in Perl 6 #22

Feeds

@nums ==> grep { $_ % 2 }
      ==> sort
      ==> map { $_ ** 2 }
      ==> @oddsquares;

Feeds also promise that statements producing the arguments are treated as closures that execute in parallel with receivers.

Thus the above is like a Unix pipeline, with each stage a separate thread and shared (lazy) list "pipes" between the stages.

Furthermore, automatic transactional protection is provided for any in-scope variables shared by the statements of the feed.

See Synopsis 6 for more on feeds.

Copyright © 2013
http://www.pmichaud.com/2013/pres/