Skip to content
Snippets Groups Projects
Commit ad371420 authored by Alexander Gehrke's avatar Alexander Gehrke
Browse files

[lec04] Scala 3 migration

parent 5e173897
No related branches found
No related tags found
No related merge requests found
package laziness
sealed trait LazyList[+A]:
enum LazyList[+A]:
case Empty
case Cons(h: () => A, t: () => LazyList[A])
// uncomment to be able to use cons(h, t) and empty directly
// imports methods from the companion object
//import LazyList._
......@@ -28,8 +31,6 @@ sealed trait LazyList[+A]:
case Cons(x, xs) => f(x(), xs().foldRight(z)(f))
case Empty => z
case object Empty extends LazyList[Nothing]
case class Cons[+A](h: () => A, t: () => LazyList[A]) extends LazyList[A]
object LazyList: // companion object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment