Scala Library
|
|
scala/collection/immutable/Stream.scala
]
object
Stream
extends
SeqFactory[Stream]Stream
provides helper functions
to manipulate streams.Value Summary | |
lazy val
|
lazy_:: : #:: |
Method Summary | |
override def
|
apply
[A](xs : A*) : Stream[A]
A stream consisting of given elements
|
implicit def
|
canBuildFrom [A] : CanBuildFrom[Stream, A, Stream[A]] |
def
|
concat
[A](xs : Iterator[Stream[A]]) : Stream[A]
The concatenation of all streams returned by an iterator
|
def
|
concat
[A](xs : Iterable[Stream[A]]) : Stream[A]
The concatenation of a sequence of streams
|
implicit def
|
consWrapper
[A](stream : => Stream[A]) : ConsWrapper[A]
A wrapper method that adds `#::` for cons and `#::: for concat as operations
to streams.
|
def
|
const
[A](elem : A) : Stream[A]
Create an infinite stream containing the given element.
|
def
|
continually
[A](elem : => A) : Stream[A]
Create an infinite stream containing the given element expression (which is computed for each
occurrence)
|
override def
|
empty
[A] : Stream[A]
The empty stream
|
override def
|
fill
[A](n : Int)(elem : => A) : Stream[A]
A traversable that contains the results of some element computation a number of times.
|
def
|
from
(start : Int) : Stream[Int]
Create an infinite stream starting at
start
and incrementing by 1. |
def
|
from
(start : Int, step : Int) : Stream[Int]
Create an infinite stream starting at
start
and incrementing by step step |
def
|
fromIterator
[A](it : Iterator[A]) : Stream[A]
A stream containing all elements of a given iterator, in the order they are produced.
|
def
|
iterate
[A](start : A)(f : (A) => A) : Stream[A]
An infinite stream that repeatedly applies a given function to a start value.
|
override def
|
iterate
[A](start : A, len : Int)(f : (A) => A) : Stream[A]
A traversable containing repeated applications of a function to a start value.
|
def
|
make
[A](n : Int, elem : A) : Stream[A]
Create a stream containing several copies of an element.
|
def
|
newBuilder
[A] : Builder[A, Stream[A]]
Creates a new builder for a stream
|
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) |
override def
|
range
(start : Int, end : Int, step : Int) : Stream[Int]
A traversable containing equally spaced values in some integer interval.
|
override def
|
tabulate
[A](n : Int)(f : (Int) => A) : Stream[A]
A traversable containing values of a given function over a range of integer values starting from 0.
|
Methods inherited from SeqFactory | |
unapplySeq |
Methods inherited from TraversableFactory | |
concat, fill, fill, fill, fill, tabulate, tabulate, tabulate, tabulate, range |
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 | |
final class
|
Cons
[+A](hd : A, tl : => Stream[A]) extends Stream[A]
A lazy cons cell, from which streams are built.
|
class
|
ConsWrapper
[A](tl : => Stream[A]) extends AnyRef
A wrapper class that adds `#::` for cons and `#:::` for concat as operations
to streams.
|
class
|
StreamBuilder
[A] extends LazyBuilder[A, Stream[A]]
A builder for streams
|
class
|
StreamCanBuildFrom
[A] extends GenericCanBuildFrom[A]
The factory for streams.
|
Object Summary | |
object
|
#::
extends AnyRef
An extractor that allows to pattern match streams with `#::`.
|
object
|
Empty
extends Stream[Nothing]
|
object
|
cons
extends AnyRef
An alternative way of building and matching Streams using Stream.cons(hd, tl).
|
Value Details |
Method Details |
implicit
def
canBuildFrom[A] : CanBuildFrom[Stream, A, Stream[A]]
implicit
def
consWrapper[A](stream : => Stream[A]) : ConsWrapper[A]
start -
the start value of the streamf -
the function that's repeatedly appliedstart -
the start value of the traversablelen -
the number of elements returned by the traversablef -
the function that's repeatedly appliedstart
and incrementing by step step
start -
the start value of the streamstep -
the increment value of the streamstart
.start
and incrementing by 1.start -
the start value of the streamstart
.elem -
the element composing the resulting streamn -
the number of elements returnedelem -
the element computationn -
The number of elements in the traversablef -
The function computing element valuesstart -
the start value of the traversableend -
the end value of the traversable (the first value NOT returned)step -
the increment value of the traversable (must be positive or negative)
def
fromIterator[A](it : Iterator[A]) : Stream[A]
it -
The iterator producing the stream's elements
def
range(start : Int, end : Int, step : (Int) => Int) : Stream[Int]
vn+1 = step(vn)
where v0 = start
and elements are in the range between start
(inclusive)
and end
(exclusive)start -
the start value of the streamend -
the end value of the streamstep -
the increment function of the stream, must be monotonically increasing or decreasingstart
.
def
const[A](elem : A) : Stream[A]
elem -
the element composing the resulting stream
def
make[A](n : Int, elem : A) : Stream[A]
n -
the length of the resulting streamelem -
the element composing the resulting stream
Scala Library
|
|