|
Scala example source code file (bug3563.scala)
The Scala bug3563.scala source code// ticket #3563 object Test { def main(args: Array[String]) { var sum = 0 val setseq = Set(1, 2, 3, 4).toSeq setseq.map( n => { sum += n; n * n }).head assert(sum == 10) sum = 0 val mapseq = Map(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4).toSeq mapseq.map( n => { sum += n._1; (n._1 + n._1, n._2 * n._2) }).head assert(sum == 10) } } Other Scala examples (source code examples)Here is a short list of links related to this Scala bug3563.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.