1 USING: help.markup help.syntax sequences ;
\r
2 IN: concurrency.combinators
\r
5 { $values { "seq" sequence } { "quot" { $quotation "( elt -- newelt )" } } { "newseq" sequence } }
\r
6 { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", collecting the results at the end." }
\r
7 { $errors "Throws an error if one of the iterations throws an error." } ;
\r
10 { $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt -- newelt )" } } { "newseq" sequence } }
\r
11 { $description "Spawns a new thread for applying " { $snippet "quot" } " to pairwise elements of " { $snippet "seq1" } " and " { $snippet "seq2" } ", collecting the results at the end." }
\r
12 { $errors "Throws an error if one of the iterations throws an error." } ;
\r
15 { $values { "seq" sequence } { "quot" { $quotation "( elt -- )" } } }
\r
16 { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", blocking until all quotations complete." }
\r
17 { $errors "Throws an error if one of the iterations throws an error." } ;
\r
19 HELP: 2parallel-each
\r
20 { $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation "( elt -- )" } } }
\r
21 { $description "Spawns a new thread for applying " { $snippet "quot" } " to pairwise elements of " { $snippet "seq1" } " and " { $snippet "seq2" } ", blocking until all quotations complete." }
\r
22 { $errors "Throws an error if one of the iterations throws an error." } ;
\r
24 HELP: parallel-filter
\r
25 { $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "newseq" sequence } }
\r
26 { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", collecting the elements for which the quotation yielded a true value." }
\r
27 { $errors "Throws an error if one of the iterations throws an error." } ;
\r
29 ARTICLE: "concurrency.combinators" "Concurrent combinators"
\r
30 "The " { $vocab-link "concurrency.combinators" } " vocabulary provides concurrent variants of various combinators."
\r
32 "Concurrent sequence combinators:"
\r
33 { $subsection parallel-each }
\r
34 { $subsection 2parallel-each }
\r
35 { $subsection parallel-map }
\r
36 { $subsection 2parallel-map }
\r
37 { $subsection parallel-filter }
\r
38 "Concurrent cleave combinators:"
\r
39 { $subsection parallel-cleave }
\r
40 { $subsection parallel-spread }
\r
41 { $subsection parallel-napply } ;
\r
43 ABOUT: "concurrency.combinators"
\r