scala.collection.immutable.Stream.cons
An alternative way of building and matching Streams using Stream.cons(hd, tl).
Attributes
- Source
-
Stream.scala
- Graph
-
- Supertypes
-
- Self type
-
Members list
A stream consisting of a given first element and remaining elements.
A stream consisting of a given first element and remaining elements.
Type parameters
- A
-
the element type of the stream
Value parameters
- hd
-
The first element of the result stream
- tl
-
The remaining elements of the result stream
Attributes
- Returns
-
a non-empty Stream whose head is hd and whose tail is lazily produced from tl
- Source
-
Stream.scala
Maps a stream to its head and tail.
Maps a stream to its head and tail.
Type parameters
- A
-
the element type of the stream
Value parameters
- xs
-
the stream to decompose
Attributes
- Returns
-
Some((head, tail)) if xs is non-empty, or None if xs is empty
- Source
-
Stream.scala