Say I have some Scala code like this:
// Outputs 1, 4, 9, 16, 25, 36, 49, 64, 81, 100
println( squares)
def squares = {
    val s = for ( count <- 1 to 10 )
                yield { count * count }
    s.mkString(", ");
}
Why do I have to use the temporary val s? I tried this:
def squares = for ( count <- 1 to 10 )
                  yield { count * count }.mkString(", ")
That fails to compile with this error message:
error: value mkString is not a member of Int
   def squares = for ( count <- 1 to 10 ) yield { count * count }.mkString(", ")
Shouldn't mkString be called on the collection returned by the for loop?
 
     
     
     
    