spark-shell cannot parse Scala lines that start with dot / period
<p>Whenever I find some Scala / Spark code online, I want to directly paste it into spark-shell to try it out. (I am using spark-shell with Spark 1.6 on both CentOS and Mac OS.)</p>

<p>Generally, this approach works well, but I always have problems when lines start with a dot / period (indicating a continuing method call). If I move the dot to the previous line, it works.</p>

<p>Example: Here is some code I found online:</p>

<pre><code>val paramMap = ParamMap(lr.maxIter -&gt; 20)
  .put(lr.maxIter, 30) 
  .put(lr.regParam -&gt; 0.1, lr.threshold -&gt; 0.55)
</code></pre>

<p>So when I paste this directly into spark-shell, I see this error:</p>

<pre><code>scala&gt; val paramMap = ParamMap(lr.maxIter -&gt; 20)
paramMap: org.apache.spark.ml.param.ParamMap = 
{
    logreg_d63b85553548-maxIter: 20
}

scala&gt;   .put(lr.maxIter, 30) 
&lt;console&gt;:1: error: illegal start of definition
         .put(lr.maxIter, 30) 
         ^

scala&gt;   .put(lr.regParam -&gt; 0.1, lr.threshold -&gt; 0.55)
&lt;console&gt;:1: error: illegal start of definition
         .put(lr.regParam -&gt; 0.1, lr.threshold -&gt; 0.55)
         ^
</code></pre>

<p>However, when I instead move the dot to the previous line, everything is ok.</p>

<pre><code>scala&gt; val paramMap = ParamMap(lr.maxIter -&gt; 20).
     | put(lr.maxIter, 30).
     | put(lr.regParam -&gt; 0.1, lr.threshold -&gt; 0.55)
paramMap: org.apache.spark.ml.param.ParamMap = 
{
    logreg_d63b85553548-maxIter: 30,
    logreg_d63b85553548-regParam: 0.1,
    logreg_d63b85553548-threshold: 0.55
}
</code></pre>

<p>Is there a way to configure spark-shell so that it will accept lines that start with a dot (or equivalently, so that it will continue lines even if they don't end in a dot)?</p>