CorecursiveList

Companion
class
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Type members

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def apply[S, A](init: S)(step: S => Maybe[(S, A)]): CorecursiveList[A]
def cons[A](a: A, fa: CorecursiveList[A]): CorecursiveList[A]

A frightfully inefficient way to add elements to the beginning of a corecursive list. It is correct, and reasonable enough for one-or-two-time use on a particular list, but be warned that iterative cons is necessarily a very inefficient way to build up a CorecursiveList.

A frightfully inefficient way to add elements to the beginning of a corecursive list. It is correct, and reasonable enough for one-or-two-time use on a particular list, but be warned that iterative cons is necessarily a very inefficient way to build up a CorecursiveList.

You can see why by taking a look at its choice of state. cons adds a Maybe to the state of the tail list, so if you cons four elements onto someCList, its state will be Maybe[Maybe[Maybe[Maybe[someCList.S]]]], and so on. This is utterly unsustainable for iterative consing.

Instead, try apply, or another more wholemeal-style combinator. You might also cons up a different structure, then transform that to a CorecursiveList wholesale and append or plus it on; that's reasonably efficient, too.

def fromStream[A](s: Stream[A]): CorecursiveList[A]

Concrete fields

Any LinearSeq converts to a CorecursiveList efficiently. No natural transformation from CorecursiveList to List exists, because representation of infinite lists is not guaranteed. Use streamIso for such cases instead.

Any LinearSeq converts to a CorecursiveList efficiently. No natural transformation from CorecursiveList to List exists, because representation of infinite lists is not guaranteed. Use streamIso for such cases instead.

Any IndexedSeq converts to a CorecursiveList efficiently. No natural transformation from CorecursiveList to Vector exists, because representation of infinite lists is not guaranteed. Use streamIso for such cases instead.

Any IndexedSeq converts to a CorecursiveList efficiently. No natural transformation from CorecursiveList to Vector exists, because representation of infinite lists is not guaranteed. Use streamIso for such cases instead.