com.twitter.algebird

Fold

object Fold extends 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, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Fold
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. implicit def applicative[I]: Applicative[[O]Fold[I, O]]

    "import Fold.

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

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. 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 }

  10. def container[I, C[_]](implicit cbf: CanBuildFrom[C[I], I, C[I]]): Fold[I, C[I]]

    Simple Fold that collects elements into a container.

  11. def count[I](pred: (I) ⇒ Boolean): Fold[I, Long]

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

  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. 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.

  15. def finalize(): Unit

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

    A Fold that returns the first value in a sequence.

  17. 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.

  18. 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.

  19. 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.

  20. 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.

  21. def foreach[I](e: (I) ⇒ Unit): Fold[I, Unit]

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

  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. def last[I]: Fold[I, Option[I]]

    A Fold that returns the last value in a sequence.

  26. 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.)

  27. 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.)

  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. 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.

  32. 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.

  33. 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.

  34. def size: Fold[Any, Long]

    A Fold that returns the length of a sequence.

  35. 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.

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

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

  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  38. def toString(): String

    Definition Classes
    AnyRef → Any
  39. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped