Aladdin - Scala Bugtracking
[#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]
Changes of this bug report
Francois  edited on  2006-03-21 17:12:07.0
Francois  edited on  2006-03-21 17:13:07.0
Francois  edited on  2006-03-21 17:23:56.0
Francois  edited on  2006-03-23 14:22:04.0
Will change soon, taking the editorial choice that the "nth column" expression makes sens provided n>=1 (i.e. change will be 's/i/n-1/').
Francois  edited on  2006-03-23 18:43:19.0
fixed at revision 6883.