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 apply [A](xs : A*) : Stream[A]
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 const [A](elem : A) : Stream[A]
Create an infinite stream containing the given element.
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 make [A](n : Int, elem : A) : Stream[A]
Create a stream containing several copies of an element.
def range (start : Int, end : Int) : Stream[Int]
Create a stream with element values vn+1 = vn + 1 where v0 = start and vi < end.
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 elements are in the range between start (inclusive) and end (exclusive)
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 elements are in the range between start (inclusive) and end (exclusive)
def unapplySeq [A](xs : Stream[A]) : Option[Seq[A]]
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
trait Definite [+A] extends Stream[A] with () => Stream[A]
a stream with a definite size
Object Summary
object cons extends AnyRef
object lazy_:: extends AnyRef
Value Details
val empty : Stream[Nothing]
The empty stream

Method Details
def apply[A](xs : A*) : Stream[A]

def unapplySeq[A](xs : Stream[A]) : Option[Seq[A]]

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.

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 elements are in the range between start (inclusive) and end (exclusive)
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 elements are in the range between start (inclusive) and end (exclusive)
Parameters
start - the start value of the stream
end - the end value of the stream
step - the increment function of the stream, must be monotonically increasing or decreasing
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.

def const[A](elem : A) : Stream[A]
Create an infinite stream containing the given element.
Parameters
elem - the element composing the resulting stream
Returns
the stream containing an inifinite number of elem

def make[A](n : Int, elem : A) : Stream[A]
Create a stream containing several copies of an element.
Parameters
n - the length of the resulting stream
elem - the element composing the resulting stream
Returns
the stream composed of n elements all equal to elem