scala

object Stream

[source: scala/Stream.scala]

object Stream
extends AnyRef
The object Stream provides helper functions to manipulate streams.
Author
Martin Odersky, Matthias Zenger
Version
1.1 08/08/03
Value Summary
val empty : Stream[Nothing]
The empty stream
Method Summary
def concat [a](s1 : Stream[a], s2 : Stream[a], ss : Stream[a]*) : Stream[a]
The concatenation of all given streams
def concat [a](xs : Iterable[Stream[a]]) : Stream[a]
The concatenation of a sequence of streams
def concat [a](xs : Iterator[Stream[a]]) : Stream[a]
The concatenation of all streams returned by an iterator
def from (start : Int, step : Int) : Stream[Int]
Create an infinite stream starting at start and incrementing by step step
def from (start : Int) : Stream[Int]
Create an infinite stream starting at start and incrementing by 1.
def fromIterator [a](it : Iterator[a]) : Stream[a]
A stream containing all elements of a given iterator, in the order they are produced.
def range (start : Int, end : Int) : Stream[Int]
Create a stream with element values vn+1 = vn + 1 where v0 = start and vi < end.
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.
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.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Object Summary
object cons extends AnyRef
Value Details
val empty : Stream[Nothing]
The empty stream

Method Details
def fromIterator[a](it : Iterator[a]) : Stream[a]
A stream containing all elements of a given iterator, in the order they are produced.
Parameters
it - The iterator producing the stream's elements

def concat[a](xs : Iterable[Stream[a]]) : Stream[a]
The concatenation of a sequence of streams

def concat[a](s1 : Stream[a], s2 : Stream[a], ss : Stream[a]*) : Stream[a]
The concatenation of all given streams

def concat[a](xs : Iterator[Stream[a]]) : Stream[a]
The concatenation of all streams returned by an iterator

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.

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.

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.

def from(start : Int, step : Int) : Stream[Int]
Create an infinite stream starting at start and incrementing by step step
Parameters
start - the start value of the stream
step - the increment value of the stream
Returns
the stream starting at value start.

def from(start : Int) : Stream[Int]
Create an infinite stream starting at start and incrementing by 1.
Parameters
start - the start value of the stream
Returns
the stream starting at value start.