Created
September 12, 2012 01:36
-
-
Save non/3703562 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Implicits { | |
| implicit def xyz[A](as:Stream[A]) = new { | |
| def takeThrough(p:A => Boolean) = tt(as) | |
| def tt[A](as:Stream[A], p:A => Boolean):Stream[A] = as match { | |
| case h #:: t => Stream.cons(h, if (p(h)) tt(t) else Stream.Empty) | |
| case e => e | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment