コレクションのマッピング内で結果を見つけるためのイディオムは次のようになります。
list.view.map(f).find(p)
ここでlistは 、List[A]はf、A => BはpですB => Boolean。
view並列コレクションで使用できますか? 非常に奇妙な結果が得られているため、質問します。
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0).
Type in expressions to have them evaluated.
Type :help for more information.
scala> val f : Int => Int = i => {println(i); i + 10}
f: Int => Int = <function1>
scala> val list = (1 to 10).toList
list: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
scala> list.par.view.map(f).find(_ > 5)
1
res0: Option[Int] = Some(11)
scala> list.par.view.map(f).find(_ > 5)
res1: Option[Int] = None