Skip to content

compilation error "value sum is not a member of List[Int]" #30

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1.enter the following in a cell:
 def problem6(max:Int): Int = {
    val nums = (for (x <- 1 to max) yield x).toList
    val sumSq=nums.map{i => i*i}.sum
    val sqSum=nums.sum*nums.sum
    return sqSum-sumSq
  }
2. evaluate

What is the expected output? What do you see instead?
expected: 
problem6: (Int)Int
actual:
<console>:6: error: value sum is not a member of List[Int]
           val sumSq=nums.map{i => i*i}.sum
                                        ^
<console>:7: error: value sum is not a member of List[Int]
           val sqSum=nums.sum*nums.sum
                          ^

What version of the product are you using? On what operating system?
scalide-2009-03-20_16-50-44.jar on ubuntu 

Please provide any additional information below.
compile just fine on the same system using netbeans

Original issue reported on code.google.com by acap...@gmail.com on 12 Dec 2010 at 10:55

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions