object process1
- Source
- process1.scala
- Alphabetic
- By Inheritance
- process1
- 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
awaitOption[I]: Process1[I, Option[I]]
Await a single value, returning
Noneif the input has been exhausted. -
def
buffer[I](n: Int): Process1[I, I]
Behaves like the identity process, but requests
nelements at a time from its input. -
def
bufferAll[I]: Process1[I, I]
Behaves like the identity process, but batches all output into a single
Emit. -
def
bufferBy[I](f: (I) ⇒ Boolean): Process1[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
chunk[I](n: Int): Process1[I, Vector[I]]
Groups inputs into chunks of size
n.Groups inputs into chunks of size
n. The last chunk may have size less thann, depending on the number of elements in the input.scala> Process(1, 2, 3, 4, 5).chunk(2).toList res0: List[Vector[Int]] = List(Vector(1, 2), Vector(3, 4), Vector(5))
- Exceptions thrown
IllegalArgumentExceptionifn<= 0
Example: -
def
chunkAll[I]: Process1[I, Vector[I]]
Collects up all output of this
Process1into a singleEmit. -
def
chunkBy[I](f: (I) ⇒ Boolean): Process1[I, Vector[I]]
Like
chunk, but emits a chunk whenever the predicate switches from true to false.Like
chunk, but emits a chunk whenever the predicate switches from true to false.scala> Process(1, 2, -1, 3, 4).chunkBy(_ > 0).toList res0: List[Vector[Int]] = List(Vector(1, 2, -1), Vector(3, 4))
-
def
chunkBy2[I](f: (I, I) ⇒ Boolean): Process1[I, Vector[I]]
Like
chunkBy, but the predicate depends on the current and previous elements. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collect[I, I2](pf: PartialFunction[I, I2]): Process1[I, I2]
Like
collecton scala collection.Like
collecton scala collection. Builds a new process by applying a partial function to all elements of this process on which the function is defined.Elements, for which the partial function is not defined are filtered out from new process
-
def
collectFirst[I, I2](pf: PartialFunction[I, I2]): Process1[I, I2]
Like
collect, but emits only the first element of this process on which the partial function is defined. -
def
delete[I](f: (I) ⇒ Boolean): Process1[I, I]
Skips the first element that matches the predicate.
Skips the first element that matches the predicate.
scala> Process(3, 4, 5, 6).delete(_ % 2 == 0).toList res0: List[Int] = List(3, 5, 6)
Example: -
def
distinctConsecutive[A](implicit arg0: Equal[A]): Process1[A, A]
Emits only elements that are distinct from their immediate predecessors.
Emits only elements that are distinct from their immediate predecessors.
scala> import scalaz.std.anyVal._ scala> Process(1, 2, 2, 1, 1, 3).distinctConsecutive.toList res0: List[Int] = List(1, 2, 1, 3)
Example: -
def
distinctConsecutiveBy[A, B](f: (A) ⇒ B)(implicit arg0: Equal[B]): Process1[A, A]
Emits only elements that are distinct from their immediate predecessors according to
f.Emits only elements that are distinct from their immediate predecessors according to
f.scala> import scalaz.std.anyVal._ scala> Process("a", "ab", "bc", "c", "d").distinctConsecutiveBy(_.length).toList res0: List[String] = List(a, ab, c)
Example: -
def
drainLeading[A, B](p: Process1[A, B]): Process1[A, B]
Remove any leading emitted values that occur before the first successful
Await.Remove any leading emitted values that occur before the first successful
Await. That means that the returnedProcess1will produce output only if it has consumed at least one input element. -
def
drop[I](n: Int): Process1[I, I]
Skips the first
nelements of the input, then passes through the rest. -
def
dropLast[I]: Process1[I, I]
Emits all but the last element of the input.
-
def
dropLastIf[I](p: (I) ⇒ Boolean): Process1[I, I]
Emits all elements of the input but skips the last if the predicate is true.
-
def
dropRight[I](n: Int): Process1[I, I]
Emits all but the last
nelements of the input. -
def
dropWhile[I](f: (I) ⇒ Boolean): Process1[I, I]
Skips elements of the input while the predicate is true, then passes through the remaining inputs.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists[I](f: (I) ⇒ Boolean): Process1[I, Boolean]
Halts with
trueas soon as a matching element is received.Halts with
trueas soon as a matching element is received. Emits a singlefalseif no input matches the predicate. -
def
feed[I, O](i: Seq[I])(p: Process1[I, O]): Process1[I, O]
Feed a sequence of inputs to a
Process1. -
def
feed1[I, O](i: I)(p: Process1[I, O]): Process1[I, O]
Feed a single input to a
Process1. -
def
filter[I](f: (I) ⇒ Boolean): Process1[I, I]
Skips any elements of the input not matching the predicate.
-
def
filterBy2[I](f: (I, I) ⇒ Boolean): Process1[I, I]
Like
filter, but the predicatefdepends on the previously emitted and current elements.Like
filter, but the predicatefdepends on the previously emitted and current elements.scala> Process(2, 4, 1, 5, 3).filterBy2(_ < _).toList res0: List[Int] = List(2, 4, 5)
Example: -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find[I](f: (I) ⇒ Boolean): Process1[I, I]
Skips any elements not satisfying predicate and when found, will emit that element and terminate
-
def
fold[A, B](z: B)(f: (B, A) ⇒ B): Process1[A, B]
Process1form ofList.fold.Process1form ofList.fold. Folds the elements of this Process using the specified associative binary operator.Unlike List.fold the order is always from the
leftside, i.e. it will always honor order ofA.If Process of
Ais empty, it will just emitzand terminatescala> Process(1, 2, 3, 4).fold(0)(_ + _).toList res0: List[Int] = List(10)
-
def
fold1[A](f: (A, A) ⇒ A): Process1[A, A]
Alias for
reduce(f). -
def
fold1Map[A, B](f: (A) ⇒ B)(implicit M: Monoid[B]): Process1[A, B]
Alias for
reduceMap(f)(M). -
def
fold1Monoid[A](implicit M: Monoid[A]): Process1[A, A]
Alias for
reduceSemigroup(M). -
def
foldMap[A, B](f: (A) ⇒ B)(implicit M: Monoid[B]): Process1[A, B]
Like
foldonly usesfto mapAtoBand uses MonoidMfor associative operation -
def
foldMonoid[A](implicit M: Monoid[A]): Process1[A, A]
Like
foldbut uses Monoid for folding operation -
def
foldSemigroup[A](implicit M: Semigroup[A]): Process1[A, A]
Alias for
reduceSemigroup(M). -
def
forall[I](f: (I) ⇒ Boolean): Process1[I, Boolean]
Emits a single
truevalue if all input matches the predicate.Emits a single
truevalue if all input matches the predicate. Halts withfalseas 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[I]: Process1[I, I]
Repeatedly echo the input; satisfies
x |> id == xandid |> x == x. -
def
intersperse[A](separator: A): Process1[A, A]
Adds
separatorbetween elements of the input.Adds
separatorbetween elements of the input. For example,scala> Process(1, 2, 3).intersperse(0).toList res0: List[Int] = List(1, 0, 2, 0, 3)
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last[I]: Process1[I, I]
Skips all but the last element of the input.
-
def
lastOr[I](li: ⇒ I): Process1[I, I]
Skips all but the last element of the input.
Skips all but the last element of the input. This
Processwill always emit exactly one value; If the input is empty,liis emitted. -
def
lift[I, O](f: (I) ⇒ O): Process1[I, O]
Transform the input using the given function,
f. -
def
liftFirst[A, B, C](f: (B) ⇒ Option[C])(p: Process1[A, B]): Process1[(A, C), (B, C)]
Transform
pto operate on the first element of a pair, passing through the right value with no modifications.Transform
pto operate on the first element of a pair, passing through the right value with no modifications. Note that this halts wheneverphalts.- f
function used to convert
Bs generated during cleanup ofpto pairs
-
def
liftL[A, B, C](p: Process1[A, B]): Process1[\/[A, C], \/[B, C]]
Transform
pto operate on the left hand side of an\/, passing through any values it receives on the right.Transform
pto operate on the left hand side of an\/, passing through any values it receives on the right. Note that this halts wheneverphalts. -
def
liftR[A, B, C](p: Process1[B, C]): Process1[\/[A, B], \/[A, C]]
Transform
pto operate on the right hand side of an\/, passing through any values it receives on the left.Transform
pto operate on the right hand side of an\/, passing through any values it receives on the left. Note that this halts wheneverphalts. -
def
liftSecond[A, B, C](f: (B) ⇒ Option[C])(p: Process1[A, B]): Process1[(C, A), (C, B)]
Transform
pto operate on the second element of a pair, passing through the left value with no modifications.Transform
pto operate on the second element of a pair, passing through the left value with no modifications. Note that this halts wheneverphalts.- f
function used to convert
Bs generated during cleanup ofpto pairs
-
def
liftY[I, O](p: Process1[I, O]): Wye[I, Any, O]
Lifts Process1 to operate on Left side of
wye, ignoring any right input.Lifts Process1 to operate on Left side of
wye, ignoring any right input. Usewye.flipto convert it to right side -
def
mapAccumulate[S, A, B](init: S)(f: (S, A) ⇒ (S, B)): Process1[A, (S, B)]
Maps a running total according to
Sand the input with the functionf.Maps a running total according to
Sand the input with the functionf.scala> Process("Hello", "World") | .mapAccumulate(0)((l, s) => (l + s.length, s.head)).toList res0: List[(Int, Char)] = List((5,H), (10,W))
- See also
Example: -
def
maximum[A](implicit A: Order[A]): Process1[A, A]
Emits the greatest element of the input.
-
def
maximumBy[A, B](f: (A) ⇒ B)(implicit arg0: Order[B]): Process1[A, A]
Emits the element
aof the input which yields the greatest value off(a). -
def
maximumOf[A, B](f: (A) ⇒ B)(implicit arg0: Order[B]): Process1[A, B]
Emits the greatest value of
f(a)for each elementaof the input. -
def
minimum[A](implicit A: Order[A]): Process1[A, A]
Emits the smallest element of the input.
-
def
minimumBy[A, B](f: (A) ⇒ B)(implicit arg0: Order[B]): Process1[A, A]
Emits the element
aof the input which yields the smallest value off(a). -
def
minimumOf[A, B](f: (A) ⇒ B)(implicit arg0: Order[B]): Process1[A, B]
Emits the smallest value of
f(a)for each elementaof the input. -
def
multiplex[I, I2, O](chanL: Process1[I, O], chanR: Process1[I2, O]): Process1[\/[I, I2], O]
Split the input and send to either
chanLorchanR, halting when either branch halts.Split the input and send to either
chanLorchanR, halting when either branch halts.scala> import scalaz.\/._ scala> import process1._ scala> Process(left(1), right('a'), left(2), right('b')) | .pipe(multiplex(lift(_ * -1), lift(_.toInt))).toList res0: List[Int] = List(-1, 97, -2, 98)
Example: -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
prefixSums[N](implicit N: Numeric[N]): Process1[N, N]
Emits the sums of prefixes (running totals) of the input elements.
Emits the sums of prefixes (running totals) of the input elements. The first value emitted will always be zero.
scala> Process(1, 2, 3).prefixSums.toList res0: List[Int] = List(0, 1, 3, 6) scala> Process[Int]().prefixSums.toList res1: List[Int] = List(0)
Example: -
def
reduce[A](f: (A, A) ⇒ A): Process1[A, A]
Process1form ofList.reduce.Process1form ofList.reduce.Reduces the elements of this Process using the specified associative binary operator.
scala> Process(1, 2, 3, 4).reduce(_ + _).toList res0: List[Int] = List(10) scala> Process(1).reduce(_ + _).toList res1: List[Int] = List(1) scala> Process[Int]().reduce(_ + _).toList res2: List[Int] = List()
Unlike
List.reducewill not fail when Process is empty. -
def
reduceMap[A, B](f: (A) ⇒ B)(implicit M: Semigroup[B]): Process1[A, B]
Like
reduceonly usesfto mapAtoBand uses SemigroupMfor associative operation. -
def
reduceMonoid[A](implicit M: Monoid[A]): Process1[A, A]
Alias for
reduceSemigroup(M). -
def
reduceSemigroup[A](implicit M: Semigroup[A]): Process1[A, A]
Like
reducebut uses SemigroupMfor associative operation. -
def
repartition[I](p: (I) ⇒ IndexedSeq[I])(implicit I: Semigroup[I]): Process1[I, I]
Repartitions the input with the function
p.Repartitions the input with the function
p. On each steppis applied to the input and all elements but the last of the resulting sequence are emitted. The last element is then prepended to the next input using the SemigroupI. For example,scala> import scalaz.std.string._ scala> Process("Hel", "l", "o Wor", "ld").repartition(_.split(" ")).toList res0: List[String] = List(Hello, World)
-
def
repartition2[I](p: (I) ⇒ (Option[I], Option[I]))(implicit I: Semigroup[I]): Process1[I, I]
Repartitions the input with the function
p.Repartitions the input with the function
p. On each steppis applied to the input and the first element of the resulting tuple is emitted if it isSome(x). The second element is then prepended to the next input using the SemigroupI. In comparison torepartitionthis allows to emit single inputs without prepending them to the next input. -
def
rethrow[A]: Process1[\/[Throwable, A], A]
Throws any input exceptions and passes along successful results.
-
def
scan[A, B](z: B)(f: (B, A) ⇒ B): Process1[A, B]
Similar to List.scan.
Similar to List.scan. Produces a process of
Bcontaining cumulative results of applying the operator to Process ofA. It will always emitz, even when the Process ofAis empty -
def
scan1[A](f: (A, A) ⇒ A): Process1[A, A]
Similar to
scan, but unlike it it won't emit thezeven when there is no input ofA.Similar to
scan, but unlike it it won't emit thezeven when there is no input ofA.scala> Process(1, 2, 3, 4).scan1(_ + _).toList res0: List[Int] = List(1, 3, 6, 10) scala> Process(1).scan1(_ + _).toList res1: List[Int] = List(1) scala> Process[Int]().scan1(_ + _).toList res2: List[Int] = List()
-
def
scan1Map[A, B](f: (A) ⇒ B)(implicit M: Semigroup[B]): Process1[A, B]
Like
scan1only usesfto mapAtoBand uses SemigroupMfor associative operation. -
def
scan1Monoid[A](implicit M: Monoid[A]): Process1[A, A]
Alias for
scanSemigroup(M). -
def
scanMap[A, B](f: (A) ⇒ B)(implicit M: Monoid[B]): Process1[A, B]
Like
scanonly usesfto mapAtoBand uses MonoidMfor associative operation -
def
scanMonoid[A](implicit M: Monoid[A]): Process1[A, A]
Like
scanbut uses Monoid for associative operation -
def
scanSemigroup[A](implicit M: Semigroup[A]): Process1[A, A]
Like
scan1but uses SemigroupMfor associative operation. -
def
shiftRight[I](head: I*): Process1[I, I]
Emit the given values, then echo the rest of the input.
Emit the given values, then echo the rest of the input.
scala> Process(3, 4).shiftRight(1, 2).toList res0: List[Int] = List(1, 2, 3, 4)
Example: -
def
skip: Process1[Any, Nothing]
Reads a single element of the input, emits nothing, then halts.
Reads a single element of the input, emits nothing, then halts.
scala> import process1._ scala> Process(1, 2, 3).pipe(skip ++ id).toList res0: List[Int] = List(2, 3)
Example: -
def
sliding[I](n: Int): Process1[I, Vector[I]]
Groups inputs in fixed size chunks by passing a "sliding window" of size
nover them.Groups inputs in fixed size chunks by passing a "sliding window" of size
nover them. If the input contains less than or equal tonelements, only one chunk of this size will be emitted.scala> Process(1, 2, 3, 4).sliding(2).toList res0: List[Vector[Int]] = List(Vector(1, 2), Vector(2, 3), Vector(3, 4))
- Exceptions thrown
IllegalArgumentExceptionifn<= 0
Example: -
def
split[I](f: (I) ⇒ Boolean): Process1[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
splitOn[I](i: I)(implicit arg0: Equal[I]): Process1[I, Vector[I]]
Break the input into chunks where the input is equal to the given delimiter.
Break the input into chunks where the input is equal to the given delimiter. The delimiter does not appear in the output. Two adjacent delimiters in the input result in an empty chunk in the output.
-
def
splitWith[I](f: (I) ⇒ Boolean): Process1[I, Vector[I]]
Breaks the input into chunks that alternatively satisfy and don't satisfy the predicate
f.Breaks the input into chunks that alternatively satisfy and don't satisfy the predicate
f.scala> Process(1, 2, -3, -4, 5, 6).splitWith(_ < 0).toList res0: List[Vector[Int]] = List(Vector(1, 2), Vector(-3, -4), Vector(5, 6))
Example: - def stateScan[S, A, B](init: S)(f: (A) ⇒ State[S, B]): Process1[A, B]
-
def
stripNone[A]: Process1[Option[A], A]
Remove any
Noneinputs. -
def
sum[N](implicit N: Numeric[N]): Process1[N, N]
Emits the sum of all input elements or zero if the input is empty.
Emits the sum of all input elements or zero if the input is empty.
scala> Process(1, 2, 3).sum.toList res0: List[Int] = List(6) scala> Process[Int]().sum.toList res1: List[Int] = List(0)
Example: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tail[I]: Process1[I, I]
Emits all elements of the input except the first one.
Emits all elements of the input except the first one.
scala> Process(1, 2, 3).tail.toList res0: List[Int] = List(2, 3) scala> Process[Int]().tail.toList res1: List[Int] = List()
Example: -
def
take[I](n: Int): Process1[I, I]
Passes through
nelements of the input, then halts. -
def
takeRight[I](n: Int): Process1[I, I]
Emits the last
nelements of the input. -
def
takeThrough[I](f: (I) ⇒ Boolean): Process1[I, I]
Like
takeWhile, but emits the first value which tests false. -
def
takeWhile[I](f: (I) ⇒ Boolean): Process1[I, I]
Passes through elements of the input as long as the predicate is true, then halts.
-
def
terminated[A]: Process1[A, Option[A]]
Wraps all inputs in
Some, then outputs a singleNonebefore halting. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unchunk[I]: Process1[Seq[I], I]
Ungroups chunked input.
Ungroups chunked input.
scala> Process(Seq(1, 2), Seq(3)).pipe(process1.unchunk).toList res0: List[Int] = List(1, 2, 3)
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[A, N](implicit N: Numeric[N]): Process1[A, (A, N)]
Zips the input with an index of type
N. -
def
zipWithIndex[A]: Process1[A, (A, Int)]
Zips the input with an index of type
Int. -
def
zipWithNext[I]: Process1[I, (I, Option[I])]
Zips every element with its next element wrapped into
Some.Zips every element with its next element wrapped into
Some. The last element is zipped withNone. -
def
zipWithPrevious[I]: Process1[I, (Option[I], I)]
Zips every element with its previous element wrapped into
Some.Zips every element with its previous element wrapped into
Some. The first element is zipped withNone. -
def
zipWithPreviousAndNext[I]: Process1[I, (Option[I], I, Option[I])]
Zips every element with its previous and next elements wrapped into
Some.Zips every element with its previous and next elements wrapped into
Some. The first element is zipped withNoneas the previous element, the last element is zipped withNoneas the next element. -
def
zipWithScan[A, B](z: B)(f: (A, B) ⇒ B): Process1[A, (A, B)]
Zips the input with a running total according to
B, up to but not including the current element.Zips the input with a running total according to
B, up to but not including the current element. Thus the initialzvalue is the first emitted to the output:scala> Process("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[A, B](z: B)(f: (A, B) ⇒ B): Process1[A, (A, B)]
Zips the input with a running total according to
B, up to and including the current element.Zips the input with a running total according to
B, up to and including the current element. Thus the initialzvalue is not emitted to the output:scala> Process("uno", "dos", "tres", "cuatro").zipWithScan1(0)(_.length + _).toList res0: List[(String,Int)] = List((uno,3), (dos,6), (tres,10), (cuatro,16))
- See also
-
def
zipWithState[A, B](z: B)(next: (A, B) ⇒ B): Process1[A, (A, B)]
Zips the input with state that begins with
zand is updated bynext. - object Await1