]> gitweb.factorcode.org Git - factor.git/blob - basis/concurrency/combinators/combinators-docs.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / concurrency / combinators / combinators-docs.factor
1 USING: help.markup help.syntax sequences ;
2 IN: concurrency.combinators
3
4 HELP: parallel-map
5 { $values { "seq" sequence } { "quot" { $quotation ( elt -- newelt ) } } { "newseq" sequence } }
6 { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", collecting the results at the end." }
7 { $errors "Throws an error if one of the iterations throws an error." } ;
8
9 HELP: 2parallel-map
10 { $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation ( elt1 elt2 -- newelt ) } } { "newseq" sequence } }
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." }
12 { $errors "Throws an error if one of the iterations throws an error." } ;
13
14 HELP: parallel-each
15 { $values { "seq" sequence } { "quot" { $quotation ( elt -- ) } } }
16 { $description "Spawns a new thread for applying " { $snippet "quot" } " to every element of " { $snippet "seq" } ", blocking until all quotations complete." }
17 { $errors "Throws an error if one of the iterations throws an error." } ;
18
19 HELP: 2parallel-each
20 { $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation ( elt1 elt2 -- ) } } }
21 { $description "Spawns a new thread for applying " { $snippet "quot" } " to pairwise elements of " { $snippet "seq1" } " and " { $snippet "seq2" } ", blocking until all quotations complete." }
22 { $errors "Throws an error if one of the iterations throws an error." } ;
23
24 HELP: parallel-filter
25 { $values { "seq" sequence } { "quot" { $quotation ( elt -- ? ) } } { "newseq" sequence } }
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." }
27 { $errors "Throws an error if one of the iterations throws an error." } ;
28
29 ARTICLE: "concurrency.combinators" "Concurrent combinators"
30 "The " { $vocab-link "concurrency.combinators" } " vocabulary provides concurrent variants of various combinators."
31 $nl
32 "Concurrent sequence combinators:"
33 { $subsections
34     parallel-each
35     2parallel-each
36     parallel-map
37     2parallel-map
38     parallel-filter
39 }
40 "Concurrent product sequence combinators:"
41 { $subsections
42     parallel-product-each
43     parallel-cartesian-each
44     parallel-product-map
45     parallel-cartesian-map
46 }
47 "Concurrent cleave combinators:"
48 { $subsections
49     parallel-cleave
50     parallel-spread
51     parallel-napply
52 }
53 "The " { $vocab-link "concurrency.semaphores" } " vocabulary can be used in conjunction with the above combinators to limit the maximum number of concurrent operations." ;
54
55 ABOUT: "concurrency.combinators"