cons

scala.collection.immutable.LazyListIterable.cons
object cons

An alternative way of building and matching lazy lists using LazyListIterable.cons(hd, tl).

Attributes

Source
LazyListIterable.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
cons.type

Members list

Value members

Concrete methods

def apply[A](hd: => A, tl: => LazyListIterable[A]): LazyListIterable[A]^{hd, tl}

A lazy list consisting of a given first element and remaining elements.

A lazy list consisting of a given first element and remaining elements.

Type parameters

A

the element type of the lazy list

Value parameters

hd

The first element of the result lazy list

tl

The remaining elements of the result lazy list

Attributes

Returns

a lazy list whose head is hd and whose tail is tl, both evaluated on demand

Source
LazyListIterable.scala
def unapply[A](xs: LazyListIterable[A]^): Option[(A, LazyListIterable[A]^{xs})]

Maps a lazy list to its head and tail.

Maps a lazy list to its head and tail.

Type parameters

A

the element type of the lazy list

Value parameters

xs

the lazy list to decompose

Attributes

Returns

Some containing the head and tail if xs is non-empty, or None if xs is empty

Source
LazyListIterable.scala