in scala
object Stream
-
object Stream
- extends Object
- with ScalaObject
-
The object
Stream
provides helper functions
to manipulate streams.
- Author:
-
Martin Odersky, Matthias Zenger
- Version:
-
1.1 08/08/03
empty
final val empty: Stream[All]
cons
final def cons[a](hd: a, def tl: Stream[a]): Stream[a]
concat
final def concat[a](xs: Seq[Stream[a]]): Stream[a]
concat
final def concat[a](xs: Iterator[Stream[a]]): Stream[a]
range
final def range(start: Int, end: Int): Stream[Int]
-
Create a stream with element values
vn+1 = vn + 1
where v0 = start
and vi < end
.
- Parameters:
start
-
the start value of the stream
end
-
the end value of the stream
- Returns:
-
the stream starting at value
start
.
range
final def range(start: Int, end: Int, step: Int): Stream[Int]
-
Create a stream with element values
vn+1 = vn + step
where v0 = start
and vi < end
.
- Parameters:
start
-
the start value of the stream
end
-
the end value of the stream
step
-
the increment value of the stream
- Returns:
-
the stream starting at value
start
.
range
final def range(start: Int, end: Int, step: (Int) => Int): Stream[Int]
-
Create a stream with element values
vn+1 = step(vn)
where v0 = start
and vi < end
.
- Parameters:
start
-
the start value of the stream
end
-
the end value of the stream
step
-
the increment function of the stream
- Returns:
-
the stream starting at value
start
.