|
[#554] |
project: scala-doc |
priority: low |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Francois |
Francois |
fixed |
2006-03-21 17:11:13.0 |
subject |
error in ScalaReference : Example 6.11.1 |
code |
Example 6.11.1, p. 67 of ScalaReference.pdf, aka circa l. 3325 of ~scala-documentation/trunk/src/reference/ReferencePart.tex
***
\example The following method returns the $n$'th column of a given
list of row-lists $xss$, using methods \lstinline@map@,
\lstinline@drop@ and \lstinline@head@ defined in class
\lstinline@scala.List@.
\begin{lstlisting}
def column[T](xss: List[List[T]], n: int): List[T] =
xss.map(.drop(i)).map(.head)
\end{lstlisting}
***
Compiling the example :
scalatest.scala:22 error: not found: value i
xss.map(.drop(i)).map(.head)
^
one error found
|
what happened |
Erroneous example (probably due to a typing error).
|
what expected |
The argument of drop should be (n-1) or n in order to match the example's description, provided that the first element of the list is numbered as the Oth or 1st element, respectively. |
[back to overview] |