Concurrent combinators


The concurrency.combinators vocabulary provides concurrent variants of various combinators.

Concurrent sequence combinators:
parallel-each ( seq quot: ( elt -- ) -- )

2parallel-each ( seq1 seq2 quot: ( elt1 elt2 -- ) -- )

parallel-map ( seq quot: ( elt -- newelt ) -- newseq )

2parallel-map ( seq1 seq2 quot: ( elt1 elt2 -- newelt ) -- newseq )

parallel-filter ( seq quot: ( elt -- ? ) -- newseq )


Concurrent product sequence combinators:
parallel-product-each ( seq quot: ( elt -- ) -- )

parallel-cartesian-each ( seq1 seq2 quot: ( elt1 elt2 -- ) -- )

parallel-product-map ( seq quot: ( elt -- newelt ) -- newseq )

parallel-cartesian-map ( seq1 seq2 quot: ( elt1 elt2 -- newelt ) -- newseq )


Concurrent cleave combinators:
parallel-cleave ( quots -- quot )

parallel-spread ( quots -- quot )

parallel-napply ( quot n -- quot )


The concurrency.semaphores vocabulary can be used in conjunction with the above combinators to limit the maximum number of concurrent operations.