object pipe
- Source
- pipe.scala
- Alphabetic
- By Inheritance
- pipe
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
buffer[F[_], I](n: Int): (Stream[F, I]) ⇒ Stream[F, I]
Behaves like the identity function, but requests
n
elements at a time from the input. -
def
bufferAll[F[_], I]: Pipe[F, I, I]
Behaves like the identity process, but emits no output until the source is exhausted.
-
def
bufferBy[F[_], I](f: (I) ⇒ Boolean): Pipe[F, I, I]
Behaves like the identity process, but requests elements from its input in blocks that end whenever the predicate switches from true to false.
-
def
changes[F[_], I](eqf: (I, I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Outputs first value, and then any changed value from the last value.
Outputs first value, and then any changed value from the last value.
eqf
is used for equality. * -
def
chunkLimit[F[_], I](n: Int): (Stream[F, I]) ⇒ Stream[F, Chunk[I]]
Outputs chunks with a limited maximum size, splitting as necessary.
-
def
chunkN[F[_], I](n: Int, allowFewer: Boolean = true): (Stream[F, I]) ⇒ Stream[F, List[Chunk[I]]]
Outputs a list of chunks, the total size of all chunks is limited and split as necessary.
-
def
chunks[F[_], I]: (Stream[F, I]) ⇒ Stream[F, Chunk[I]]
Output all chunks from the input
Handle
. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collect[F[_], I, I2](pf: PartialFunction[I, I2]): (Stream[F, I]) ⇒ Stream[F, I2]
Map/filter simultaneously.
Map/filter simultaneously. Calls
collect
on eachChunk
in the stream. -
def
collectFirst[F[_], I, I2](pf: PartialFunction[I, I2]): (Stream[F, I]) ⇒ Stream[F, I2]
Emits the first element of the Stream for which the partial function is defined.
- def covary[F[_], I, O](p: (Stream[Pure, I]) ⇒ Stream[Pure, O]): Pipe[F, I, O]
-
def
delete[F[_], I](p: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Skip the first element that matches the predicate.
-
def
drop[F[_], I](n: Long): (Stream[F, I]) ⇒ Stream[F, I]
Drop
n
elements of the input, then echo the rest. -
def
dropLast[F[_], I]: Pipe[F, I, I]
Drops the last element.
-
def
dropLastIf[F[_], I](p: (I) ⇒ Boolean): Pipe[F, I, I]
Drops the last element if the predicate evaluates to true.
-
def
dropRight[F[_], I](n: Int): (Stream[F, I]) ⇒ Stream[F, I]
Emits all but the last
n
elements of the input. -
def
dropWhile[F[_], I](p: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Drop the elements of the input until the predicate
p
fails, then echo the rest. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists[F[_], I](p: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, Boolean]
Emits
true
as soon as a matching element is received, elsefalse
if no input matches -
def
filter[F[_], I](f: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Emit only inputs which match the supplied predicate.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find[F[_], I](f: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Emits the first input (if any) which matches the supplied predicate, to the output of the returned
Pull
-
def
fold[F[_], I, O](z: O)(f: (O, I) ⇒ O): (Stream[F, I]) ⇒ Stream[F, O]
Folds all inputs using an initial value
z
and supplied binary operator, and emits a single element stream. -
def
fold1[F[_], I](f: (I, I) ⇒ I): (Stream[F, I]) ⇒ Stream[F, I]
Folds all inputs using the supplied binary operator, and emits a single-element stream, or the empty stream if the input is empty.
-
def
forall[F[_], I](p: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, Boolean]
Emits a single
true
value if all input matches the predicate.Emits a single
true
value if all input matches the predicate. Halts withfalse
as soon as a non-matching element is received. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
id[F[_], I]: (Stream[F, I]) ⇒ Stream[F, I]
Write all inputs to the output of the returned
Pull
. -
def
intersperse[F[_], I](separator: I): (Stream[F, I]) ⇒ Stream[F, I]
Emits the specified separator between every pair of elements in the source stream.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last[F[_], I]: (Stream[F, I]) ⇒ Stream[F, Option[I]]
Return the last element of the input
Handle
, if nonempty. -
def
lastOr[F[_], I](li: ⇒ I): (Stream[F, I]) ⇒ Stream[F, I]
Return the last element of the input
Handle
if nonempty, otherwise li. -
def
lift[F[_], I, O](f: (I) ⇒ O): (Stream[F, I]) ⇒ Stream[F, O]
Write all inputs to the output of the returned
Pull
, transforming elements usingf
.Write all inputs to the output of the returned
Pull
, transforming elements usingf
. Works in a chunky fashion and creates aChunk.indexedSeq
for each mapped chunk. -
def
mapAccumulate[F[_], S, I, O](init: S)(f: (S, I) ⇒ (S, O)): (Stream[F, I]) ⇒ Stream[F, (S, O)]
Maps a running total according to
S
and the input with the functionf
.Maps a running total according to
S
and the input with the functionf
.scala> Stream("Hello", "World") | .mapAccumulate(0)((l, s) => (l + s.length, s.head)).toVector res0: Vector[(Int, Char)] = Vector((5,H), (10,W))
Example: -
def
mapChunks[F[_], I, O](f: (Chunk[I]) ⇒ Chunk[O]): (Stream[F, I]) ⇒ Stream[F, O]
Output a transformed version of all chunks from the input
Handle
. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
prefetch[F[_], I](implicit arg0: Async[F]): (Stream[F, I]) ⇒ Stream[F, I]
Behaves like
id
, but starts fetching the next chunk before emitting the current, enabling processing on either side of theprefetch
to run in parallel. -
def
reduce[F[_], I](f: (I, I) ⇒ I): (Stream[F, I]) ⇒ Stream[F, I]
Alias for
pipe.fold1
-
def
rethrow[F[_], I]: (Stream[F, Either[Throwable, I]]) ⇒ Stream[F, I]
Rethrow any
Left(err)
.Rethrow any
Left(err)
. Preserves chunkiness. -
def
scan[F[_], I, O](z: O)(f: (O, I) ⇒ O): (Stream[F, I]) ⇒ Stream[F, O]
Left fold which outputs all intermediate results.
Left fold which outputs all intermediate results. Example:
Stream(1,2,3,4) through pipe.scan(0)(_ + _) == Stream(0,1,3,6,10)
.More generally:
Stream().scan(z)(f) == Stream(z)
Stream(x1).scan(z)(f) == Stream(z, f(z,x1))
Stream(x1,x2).scan(z)(f) == Stream(z, f(z,x1), f(f(z,x1),x2))
etcWorks in a chunky fashion, and creates a
Chunk.indexedSeq
for each converted chunk. -
def
scan1[F[_], I](f: (I, I) ⇒ I): (Stream[F, I]) ⇒ Stream[F, I]
Like
pipe.scan
, but uses the first element of the stream as the seed. -
def
shiftRight[F[_], I](head: I*): (Stream[F, I]) ⇒ Stream[F, I]
Emit the given values, then echo the rest of the input.
-
def
sliding[F[_], I](n: Int): (Stream[F, I]) ⇒ Stream[F, Vector[I]]
Groups inputs in fixed size chunks by passing a "sliding window" of size
n
over them.Groups inputs in fixed size chunks by passing a "sliding window" of size
n
over them. If the input contains less than or equal ton
elements, only one chunk of this size will be emitted.scala> Stream(1, 2, 3, 4).sliding(2).toList res0: List[Chunk[Int]] = List(Chunk(1, 2), Chunk(2, 3), Chunk(3, 4))
- Exceptions thrown
IllegalArgumentException
ifn
<= 0
Example: -
def
split[F[_], I](f: (I) ⇒ Boolean): Pipe[F, I, Vector[I]]
Break the input into chunks where the delimiter matches the predicate.
Break the input into chunks where the delimiter matches the predicate. The delimiter does not appear in the output. Two adjacent delimiters in the input result in an empty chunk in the output.
- def stepper[I, O](p: (Stream[Pure, I]) ⇒ Stream[Pure, O]): Stepper[I, O]
-
def
sum[F[_], I](implicit ev: Numeric[I]): (Stream[F, I]) ⇒ Stream[F, I]
Writes the sum of all input elements, or zero if the input is empty.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tail[F[_], I]: (Stream[F, I]) ⇒ Stream[F, I]
Emits all elements of the input except the first one.
-
def
take[F[_], I](n: Long): (Stream[F, I]) ⇒ Stream[F, I]
Emit the first
n
elements of the inputHandle
and return the newHandle
. -
def
takeRight[F[_], I](n: Long): (Stream[F, I]) ⇒ Stream[F, I]
Emits the last
n
elements of the input. -
def
takeThrough[F[_], I](f: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Like
takeWhile
, but emits the first value which tests false. -
def
takeWhile[F[_], I](f: (I) ⇒ Boolean): (Stream[F, I]) ⇒ Stream[F, I]
Emit the longest prefix of the input for which all elements test true according to
f
. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unNoneTerminate[F[_], I]: (Stream[F, Option[I]]) ⇒ Stream[F, I]
Halt the input stream at the first
None
.Halt the input stream at the first
None
.scala> unNoneTerminate(Stream(Some(1), Some(2), None, Some(3), None)).toVector res0: Vector[Int] = Vector(1, 2)
Example: -
def
unchunk[F[_], I]: (Stream[F, I]) ⇒ Stream[F, I]
Convert the input to a stream of solely 1-element chunks.
-
def
vectorChunkN[F[_], I](n: Int, allowFewer: Boolean = true): (Stream[F, I]) ⇒ Stream[F, Vector[I]]
Groups inputs into separate
Vector
objects of sizen
.Groups inputs into separate
Vector
objects of sizen
.scala> Stream(1, 2, 3, 4, 5).vectorChunkN(2).toVector res0: Vector[Vector[Int]] = Vector(Vector(1, 2), Vector(3, 4), Vector(5))
Example: -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
zipWithIndex[F[_], I]: (Stream[F, I]) ⇒ Stream[F, (I, Int)]
Zip the elements of the input
Handle
with its indices, and return the newHandle
-
def
zipWithNext[F[_], I]: (Stream[F, I]) ⇒ Stream[F, (I, Option[I])]
Zip the elements of the input
Handle
with its next element wrapped intoSome
, and return the newHandle
.Zip the elements of the input
Handle
with its next element wrapped intoSome
, and return the newHandle
. The last element is zipped withNone
. -
def
zipWithPrevious[F[_], I]: (Stream[F, I]) ⇒ Stream[F, (Option[I], I)]
Zip the elements of the input
Handle
with its previous element wrapped intoSome
, and return the newHandle
.Zip the elements of the input
Handle
with its previous element wrapped intoSome
, and return the newHandle
. The first element is zipped withNone
. -
def
zipWithPreviousAndNext[F[_], I]: (Stream[F, I]) ⇒ Stream[F, (Option[I], I, Option[I])]
Zip the elements of the input
Handle
with its previous and next elements wrapped intoSome
, and return the newHandle
.Zip the elements of the input
Handle
with its previous and next elements wrapped intoSome
, and return the newHandle
. The first element is zipped withNone
as the previous element, the last element is zipped withNone
as the next element. -
def
zipWithScan[F[_], I, S](z: S)(f: (S, I) ⇒ S): (Stream[F, I]) ⇒ Stream[F, (I, S)]
Zips the input with a running total according to
S
, up to but not including the current element.Zips the input with a running total according to
S
, up to but not including the current element. Thus the initialz
value is the first emitted to the output:scala> Stream("uno", "dos", "tres", "cuatro").zipWithScan(0)(_ + _.length).toList res0: List[(String,Int)] = List((uno,0), (dos,3), (tres,6), (cuatro,10))
- See also
-
def
zipWithScan1[F[_], I, S](z: S)(f: (S, I) ⇒ S): (Stream[F, I]) ⇒ Stream[F, (I, S)]
Zips the input with a running total according to
S
, including the current element.Zips the input with a running total according to
S
, including the current element. Thus the initialz
value is the first emitted to the output:scala> Stream("uno", "dos", "tres", "cuatro").zipWithScan(0)(_ + _.length).toList res0: List[(String,Int)] = List((uno,0), (dos,3), (tres,6), (cuatro,10))
- See also
- object Stepper