git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Streamer@68971 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -56,12 +56,21 @@ Reducer(FUN, init, ..., yieldNth = NA_integer_) |
56 | 56 |
|
57 | 57 |
\examples{ |
58 | 58 |
s <- stream(Seq(to=10), Reducer("+")) |
59 |
-yield(s) ## sum(1:10) |
|
59 |
+yield(s) ## sum(1:10), i.e., Reduce over the entire stream |
|
60 | 60 |
s <- stream(Seq(to=10), Reducer("+", yieldNth=5)) |
61 | 61 |
yield(s) ## sum(1:5) |
62 | 62 |
yield(s) ## sum(6:10) |
63 | 63 |
s <- stream(Seq(to=10), Reducer("+", init=10, yieldNth=5)) |
64 | 64 |
sapply(s, c) ## 10 + c(sum(1:5), sum(6:10)) |
65 |
+if (.Platform$OS.type != "windows") { |
|
66 |
+ s <- stream(Seq(to=10), |
|
67 |
+ Team(function(i) { Sys.sleep(1); i }, |
|
68 |
+ param=MulticoreParam(10L)), |
|
69 |
+ Reducer("+")) |
|
70 |
+ system.time(y <- yield(s)) |
|
71 |
+ y |
|
72 |
+} |
|
73 |
+ |
|
65 | 74 |
} |
66 | 75 |
|
67 | 76 |
\keyword{classes} |