Created
January 13, 2013 00:13
-
-
Save Sciss/4521189 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 Generator { | |
def apply[A](head: A)(next: A => A) : Generator[A] = Impl(head, next) | |
private final case class Impl[A](override val head: A, next: A => A) | |
extends Generator[A] { | |
protected def underlying = this | |
} | |
} | |
sealed trait Generator[A] | |
extends IterableView[A, Generator[A]] with IterableViewLike[A, Generator[A], Generator[A]] { | |
protected def next: A => A | |
def iterator = Iterator.iterate(head)(next) | |
trait Transformed[B] extends Generator[B] // with super[IterableViewLike].Transformed[B] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment