Advertisement
Guest User

Untitled

a guest
Sep 7th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.21 KB | None | 0 0
  1. /** An extractor that allows to pattern match streams with `#::`.
  2.    */
  3.   object #:: {
  4.     def unapply[A](xs: Stream[A]): Option[(A, Stream[A])] =
  5.       if (xs.isEmpty) None
  6.       else Some((xs.head, xs.tail))
  7.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement