Object/Trait

com.twitter.algebird

Fold

Related Docs: trait Fold | package algebird

Permalink

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

Source
Fold.scala
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
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit def applicative[I]: Applicative[[O]Fold[I, O]]

    Permalink

    "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

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def const[O](value: O): Fold[Any, O]

    Permalink

    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: CanBuildFrom[C[I], I, C[I]]): Fold[I, C[I]]

    Permalink

    Simple Fold that collects elements into a container.

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

    Permalink

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def exists[I](pred: (I) ⇒ Boolean): Fold[I, Boolean]

    Permalink

    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

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

    Permalink

    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]

    Permalink

    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]

    Permalink

    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]

    Permalink

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

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

    Permalink

    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]

    Permalink

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

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

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

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

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

    Permalink

    A Fold that returns the last value in a sequence.

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

    Permalink

    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]]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. def product[I](implicit numeric: Ring[I]): Fold[I, I]

    Permalink

    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]]

    Permalink

    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]]

    Permalink

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

  32. def size: Fold[Any, Long]

    Permalink

    A Fold that returns the length of a sequence.

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

    Permalink

    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]]

    Permalink

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

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

    Permalink
    Definition Classes
    AnyRef
  36. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped