|
Scala example source code file (bug1220.scala)
The Scala bug1220.scala source code
object Test extends App {
class QSRichIterable[A](self: Iterable[A]) {
def filterMap[R](f: PartialFunction[A,R]) =
self filter (f.isDefinedAt) map f
}
object Un {
def unapply(i: Int): Option[Int] = Some(i)
}
val richIter = new QSRichIterable(List(0, 1, 2, 3, 4))
assert((richIter filterMap {case Un(3) => 7}) == List(7))
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala bug1220.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.