You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by an...@apache.org on 2014/05/20 23:02:49 UTC
svn commit: r1596416 - in /spark: examples.md site/examples.html
Author: andrew
Date: Tue May 20 21:02:48 2014
New Revision: 1596416
URL: http://svn.apache.org/r1596416
Log:
fix bug in pi example replacing ()'s with {}'s
Modified:
spark/examples.md
spark/site/examples.html
Modified: spark/examples.md
URL: http://svn.apache.org/viewvc/spark/examples.md?rev=1596416&r1=1596415&r2=1596416&view=diff
==============================================================================
--- spark/examples.md (original)
+++ spark/examples.md Tue May 20 21:02:48 2014
@@ -167,11 +167,11 @@ In this example, we search through the e
</div>
<div class="tab-pane tab-pane-scala">
<div class="code code-tab">
- <span class="keyword">val</span> count = spark.parallelize(1 to NUM_SAMPLES).<span class="sparkop">map</span>(<span class="closure">i =><br>
+ <span class="keyword">val</span> count = spark.parallelize(1 to NUM_SAMPLES).<span class="sparkop">map</span>{<span class="closure">i =><br>
val x = Math.random()<br>
val y = Math.random()<br>
if (x*x + y*y < 1) 1 else 0<br>
- </span>).<span class="sparkop">reduce</span>(<span class="closure">_ + _</span>)<br>
+ </span>}.<span class="sparkop">reduce</span>(<span class="closure">_ + _</span>)<br>
println(<span class="string">"Pi is roughly "</span> + 4.0 * count / NUM_SAMPLES)<br>
</div>
</div>
Modified: spark/site/examples.html
URL: http://svn.apache.org/viewvc/spark/site/examples.html?rev=1596416&r1=1596415&r2=1596416&view=diff
==============================================================================
--- spark/site/examples.html (original)
+++ spark/site/examples.html Tue May 20 21:02:48 2014
@@ -317,11 +317,11 @@ previous ones, and <em>actions</em>, whi
</div>
<div class="tab-pane tab-pane-scala">
<div class="code code-tab">
- <span class="keyword">val</span> count = spark.parallelize(1 to NUM_SAMPLES).<span class="sparkop">map</span>(<span class="closure">i =><br />
+ <span class="keyword">val</span> count = spark.parallelize(1 to NUM_SAMPLES).<span class="sparkop">map</span>{<span class="closure">i =><br />
val x = Math.random()<br />
val y = Math.random()<br />
if (x*x + y*y < 1) 1 else 0<br />
- </span>).<span class="sparkop">reduce</span>(<span class="closure">_ + _</span>)<br />
+ </span>}.<span class="sparkop">reduce</span>(<span class="closure">_ + _</span>)<br />
println(<span class="string">"Pi is roughly "</span> + 4.0 * count / NUM_SAMPLES)<br />
</div>
</div>