summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-11-18 14:22:56 +0000
committerMartin Odersky <odersky@gmail.com>2003-11-18 14:22:56 +0000
commit0d064c5f91d0ba8640785841858881a7e1eb9f82 (patch)
treef5684b40ffc469aee2c617801c44560322cb3e18 /doc
parent3b343cbf530a0de5755495a523a23a57846ec572 (diff)
downloadscala-0d064c5f91d0ba8640785841858881a7e1eb9f82.tar.gz
scala-0d064c5f91d0ba8640785841858881a7e1eb9f82.tar.bz2
scala-0d064c5f91d0ba8640785841858881a7e1eb9f82.zip
*** empty log message ***
Diffstat (limited to 'doc')
-rw-r--r--doc/reference/ScalaReference.tex10
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/reference/ScalaReference.tex b/doc/reference/ScalaReference.tex
index 3b908da764..8b57be5ea4 100644
--- a/doc/reference/ScalaReference.tex
+++ b/doc/reference/ScalaReference.tex
@@ -2951,7 +2951,7 @@ A semicolon preceding the \code{while} symbol of a do loop expression is ignored
\section{Comprehensions}
\syntax\begin{lstlisting}
- Expr ::= for `(' Enumerators `)' (do | yield) Expr
+ Expr ::= for `(' Enumerators `)' [yield] Expr
Enumerator ::= Generator {`;' Enumerator}
Enumerator ::= Generator
| Expr
@@ -2992,7 +2992,7 @@ is translated to
\item
A for-comprehension
-~\lstinline@for (val $p$ <- $e\,$) do $e'$@~
+~\lstinline@for (val $p$ <- $e\,$) $e'$@~
is translated to
~\lstinline@$e$.foreach { case $p$ => $e'$ }@.
@@ -3010,13 +3010,13 @@ $e$.flatmap { case $p$ => for (val $p'$ <- $e'; \ldots$) yield $e''$ } .
\item
A for-comprehension
\begin{lstlisting}
-for (val $p$ <- $e$; val $p'$ <- $e'; \ldots$) do $e''$ .
+for (val $p$ <- $e$; val $p'$ <- $e'; \ldots$) $e''$ .
\end{lstlisting}
where \lstinline@$\ldots$@ is a (possibly empty)
sequence of generators or filters,
is translated to
\begin{lstlisting}
-$e$.foreach { case $p$ => for (val $p'$ <- $e'; \ldots$) do $e''$ } .
+$e$.foreach { case $p$ => for (val $p'$ <- $e'; \ldots$) $e''$ } .
\end{lstlisting}
\end{itemize}
@@ -3094,7 +3094,7 @@ Here is a function to compute the scalar product of two vectors:
\begin{lstlisting}
def scalprod(xs: Array[double], ys: Array[double]) {
var acc = 0.0;
- for (val Pair(x, y) <- xs zip ys) do acc = acc + x * y;
+ for (val Pair(x, y) <- xs zip ys) acc = acc + x * y;
acc
}
\end{lstlisting}