| 
 | 
          Scala 1.3.0.7 | |||
The class Stream implements lazy lists where elements
 are only evaluated when they are needed. Here is an example:
 object Main with Application {
   def from(n: Int): Stream[Int] =
     Stream.cons(n, from(n + 1));
   def sieve(s: Stream[Int]): Stream[Int] =
     Stream.cons(s.head, sieve(s.tail filter { x => x % s.head != 0 }));
   def primes = sieve(from(2));
   primes take 10 print
 }
 
| Method Summary | |
| def append[b >: a](def rest: Stream[b]): Stream[b] | |
| def apply(n: Int): a | |
| def at(n: Int): a | |
| 
        override | def copyToArray[b >: a](xs: Array[b], start: Int): Array[b]Fills the given array xswith the elements of
  this sequence starting at positionstart. | 
| 
        override | def drop(n: Int): Stream[a]Returns a new sub-sequence that drops the first nelements of this sequence. | 
| def dropWhile(p: (a) => Boolean): Stream[a] | |
| def elements: Iterator[a]Creates a new iterator over all elements contained in this object. | |
| 
        override | def exists(p: (a) => Boolean): BooleanApply a predicate pto all elements of this
  iterable object and return true, iff there is at least one
  element for whichpyields true. | 
| def filter(p: (a) => Boolean): Stream[a] | |
| def flatMap[b](f: (a) => Stream[b]): Stream[b] | |
| 
        override | def foldLeft[b](z: b)(f: (b,a) => b): bCombines the elements of this list together using the binary operator op, from left to right, and starting with
  the valuez. | 
| 
        override | def foldRight[b](z: b)(f: (a,b) => b): bCombines the elements of this list together using the binary operator op, from rigth to left, and starting with
  the valuez. | 
| 
        override | def forall(p: (a) => Boolean): BooleanApply a predicate pto all elements of this
  iterable object and return true, iff the predicate yields
  true for all elements. | 
| 
        override | def foreach(f: (a) => Unit): UnitApply a function fto all elements of this
  iterable object. | 
| 
        abstract | def head: a | 
| def init: Stream[a] | |
| 
        abstract | def isEmpty: Boolean | 
| def last: a | |
| def length: IntReturns the length of the sequence. | |
| def map[b](f: (a) => b): Stream[b] | |
| def print: Unit | |
| 
        abstract | def printElems(buf: StringBuffer, prefix: String): StringBuffer | 
| def reduceLeft[b >: a](f: (b,b) => b): b | |
| def reduceRight[b >: a](f: (b,b) => b): b | |
| def reverse: Stream[a] | |
| 
        abstract | def tail: Stream[a] | 
| 
        override | def take(n: Int): Stream[a]Returns the sub-sequence starting from index n. | 
| def takeWhile(p: (a) => Boolean): Stream[a] | |
| 
        override | def toString(): StringCustomizes the toStringmethod. | 
| def zip[b](that: Stream[b]): Stream[Tuple2[a,b]] | |
| Methods inherited from java/lang/Object-class | 
| clone, eq, equals, finalize, getClass, hashCode, notify, notifyAll, synchronized, wait, wait, wait | 
| Methods inherited from scala/Any-class | 
| !=, ==, asInstanceOf, isInstanceOf, match | 
| Methods inherited from scala/Iterable-class | 
| /:, :\, find, sameElements | 
| Methods inherited from scala/ScalaObject-class | 
| getType | 
| Methods inherited from scala/Seq-class | 
| indexOf, isDefinedAt, lastIndexOf, stringPrefix, subseq, toList | 
| Method Detail | 
abstract def isEmpty: Boolean
abstract def head: a
abstract def tail: Stream[a]
def length: Int
def append[b >: a](def rest: Stream[b]): Stream[b]
def elements: Iterator[a]
def init: Stream[a]
def last: a
override def take(n: Int): Stream[a]
n.
  
override def drop(n: Int): Stream[a]
n
  elements of this sequence.
  
def apply(n: Int): a
def at(n: Int): a
def takeWhile(p: (a) => Boolean): Stream[a]
def dropWhile(p: (a) => Boolean): Stream[a]
def map[b](f: (a) => b): Stream[b]
override def foreach(f: (a) => Unit): Unit
f to all elements of this
  iterable object.
f - 
  a function that is applied to every element.
     
  def filter(p: (a) => Boolean): Stream[a]
override def forall(p: (a) => Boolean): Boolean
p to all elements of this
  iterable object and return true, iff the predicate yields
  true for all elements.
p - 
  the predicate
  override def exists(p: (a) => Boolean): Boolean
p to all elements of this
  iterable object and return true, iff there is at least one
  element for which p yields true.
p - 
  the predicate
  override def foldLeft[b](z: b)(f: (b,a) => b): b
op, from left to right, and starting with
  the value z. op(... (op(op(z,a0),a1) ...), an) if the list
  is List(a0, a1, ..., an).
     
override def foldRight[b](z: b)(f: (a,b) => b): b
op, from rigth to left, and starting with
  the value z. a0 op (... op (an op z)...) if the list
  is [a0, a1, ..., an].
     
def reduceLeft[b >: a](f: (b,b) => b): b
def reduceRight[b >: a](f: (b,b) => b): b
def flatMap[b](f: (a) => Stream[b]): Stream[b]
def reverse: Stream[a]
override def copyToArray[b >: a](xs: Array[b], start: Int): Array[b]
xs with the elements of
  this sequence starting at position start.
xs - 
  the array to fill.
  start - 
  starting index.
  xs filled with this list.
  
def zip[b](that: Stream[b]): Stream[Tuple2[a,b]]
def print: Unit
override def toString(): String
toString method.
abstract def printElems(buf: StringBuffer, prefix: String): StringBuffer
| 
 | 
          Scala 1.3.0.7 | |||