blob: 0d6caa8d7a6a485ebc160b21275d63d06f56a786 (
plain) (
blame)
1
2
3
4
5
6
|
object Test {
// @annotation.tailrec
def lazyFilter[E](s: Stream[E], p: E => Boolean): Stream[E] = s match {
case h #:: t => if (p(h)) h #:: lazyFilter(t, p) else lazyFilter(t, p)
}
}
|