Packages

object Fold extends CompatFold with Serializable

Methods to create and run Folds.

The Folds defined here are immutable and serializable, which we expect by default. It is important that you as a user indicate mutability or non-serializability when defining new Folds. Additionally, it is recommended that "end" functions not mutate the accumulator in order to support scans (producing a stream of intermediate outputs by calling "end" at each step).

Linear Supertypes
Serializable, CompatFold, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fold
  2. Serializable
  3. CompatFold
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. implicit def applicative[I]: Applicative[[β$0$]Fold[I, β$0$]]

    "import Fold.applicative" will bring the Applicative instance into scope.

    "import Fold.applicative" will bring the Applicative instance into scope. See FoldApplicative.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def const[O](value: O): Fold[Any, O]

    A Fold that does no work and returns a constant.

    A Fold that does no work and returns a constant. Analogous to Function1 const: def const[A, B](b: B): (A => B) = { _ => b }

  8. def container[I, C[_]](implicit cbf: Factory[I, C[I]]): Fold[I, C[I]]

    Simple Fold that collects elements into a container.

    Simple Fold that collects elements into a container.

    Definition Classes
    CompatFold
  9. def count[I](pred: (I) => Boolean): Fold[I, Long]

    A Fold that counts the number of elements satisfying the predicate.

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def exists[I](pred: (I) => Boolean): Fold[I, Boolean]

    A Fold that returns "true" if any element of the sequence statisfies the predicate.

    A Fold that returns "true" if any element of the sequence statisfies the predicate. Note this does not short-circuit enumeration of the sequence.

  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. def first[I]: Fold[I, Option[I]]

    A Fold that returns the first value in a sequence.

  15. def fold[M, I, O](add: (M, I) => M, start: M, end: (M) => O): Fold[I, O]

    A general way of defining Folds that supports a separate accumulator type.

    A general way of defining Folds that supports a separate accumulator type. The accumulator MUST be immutable and serializable.

  16. def foldLeft[I, O](o: O)(add: (O, I) => O): Fold[I, O]

    Turn a common Scala foldLeft into a Fold.

    Turn a common Scala foldLeft into a Fold. The accumulator MUST be immutable and serializable.

  17. def foldMutable[M, I, O](add: (M, I) => M, start: (Unit) => M, end: (M) => O): Fold[I, O]

    A general way of defining Folds that supports constructing mutable or non-serializable accumulators.

  18. def forall[I](pred: (I) => Boolean): Fold[I, Boolean]

    A Fold that returns "true" if all elements of the sequence statisfy the predicate.

    A Fold that returns "true" if all elements of the sequence statisfy the predicate. Note this does not short-circuit enumeration of the sequence.

  19. def foreach[I](e: (I) => Unit): Fold[I, Unit]

    A Fold that runs the given side effect for every element.

  20. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def last[I]: Fold[I, Option[I]]

    A Fold that returns the last value in a sequence.

  24. def max[I](implicit ordering: Ordering[I]): Fold[I, Option[I]]

    A Fold that returns the max value in a sequence.

    A Fold that returns the max value in a sequence. (Biased to earlier equal values.)

  25. def min[I](implicit ordering: Ordering[I]): Fold[I, Option[I]]

    A Fold that returns a min value in a sequence.

    A Fold that returns a min value in a sequence. (Biased to earlier equal values.)

  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. def product[I](implicit numeric: Ring[I]): Fold[I, I]

    A Fold that returns the product of a numeric sequence.

    A Fold that returns the product of a numeric sequence. Does not protect against overflow.

  30. def seq[I]: Fold[I, Seq[I]]

    An even simpler Fold that collects into a Seq.

    An even simpler Fold that collects into a Seq. Shorthand for "container[I, Seq];" fewer type arguments, better type inferrence.

  31. def sequence[I, O](ms: Seq[Fold[I, O]]): Fold[I, Seq[O]]

    Fuse a sequence of Folds into one that outputs the result of each.

  32. def size: Fold[Any, Long]

    A Fold that returns the length of a sequence.

  33. def sum[I](implicit numeric: Monoid[I]): Fold[I, I]

    A Fold that returns the sum of a numeric sequence.

    A Fold that returns the sum of a numeric sequence. Does not protect against overflow.

  34. def sumOption[T](implicit sg: Semigroup[T]): Fold[T, Option[T]]

    For a semigroup, if we get more than 0 items, use plus

  35. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  39. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from CompatFold

Inherited from AnyRef

Inherited from Any

Ungrouped