_aggregate

trait _aggregate
class java.lang.Object
trait scala.Matchable
class Any
trait _use
object ~

Def

inline def fold[A](inline start: A)(inline f: (A, A) => A): A

Fold

Fold

Folds elements with a binary function

    // Calculate sum of first 1000 Ints

    (1 <> 1000).~.fold(0)(_ + _) // Returns 500500
Value Params
f

binary function to fold elements with

start

seed value to start with

Source
_aggregate.scala
inline def FOLD[A](inline start: A)(inline f: (A, A) => A): A

Heavy Fold

Heavy Fold

Folds elements with a binary function

FOLD is functionally equivalent to fold, but is fully inlined. It makes compiled code larger, but guarantees the best possible performance on large streams.

Source
_aggregate.scala
inline def FOLD_AS[A](inline start: B)(inline f: (B, A) => B): B

Heavy Fold and convert

Heavy Fold and convert

Folds and converts elements with a binary function

FOLD_AS is functionally equivalent to foldAs, but is fully inlined. It makes compiled code larger, but guarantees the best possible performance on large streams.

Source
_aggregate.scala
inline def foldAs[A](inline start: B)(inline f: (B, A) => B): B

Fold and convert

Fold and convert

Folds and converts elements with a binary function

    // Calculate sum of first 1000 Ints

    (1 <> 1000).~.foldAs(0L)(_ + _) // Returns 500500
Value Params
f

binary function to fold elements with

start

seed value to start with

Source
_aggregate.scala
inline def reduce[A](inline f: (A, A) => A): A

Reduce

Reduce

Folds elements with a binary function

   // Calculate sum of first 1000 Ints

   (1 <> 1000).~.reduce(_ + _) // Returns 500500

Note. Threre is no default value, and if stream is empty, operation fails. Use reduce_? as safer option

Value Params
f

binary function to fold elements with

Source
_aggregate.scala
inline def REDUCE[A](inline f: (A, A) => A): A

Heavy reduce

Heavy reduce

Folds elements with a binary function

REDUCE is functionally equivalent to reduce, but is fully inlined. It makes compiled code larger, but guarantees the best possible performance on large streams.

Source
_aggregate.scala
@scala.annotation.targetName("reduce_Opt")
inline def reduce_?[A](inline f: (A, A) => A): Opt[A]

Optional reduce

Optional reduce

Folds elements with a binary function or returns empty option when stream is empty

    // Calculate sum of first 1000 Ints

    (1 <> 1000).~.reduce_?(_ + _) // Returns Opt(500500)
Value Params
f

binary function to fold elements with

Source
_aggregate.scala
@scala.annotation.targetName("REDUCE_Opt")
inline def REDUCE_?[A](inline f: (A, A) => A): Opt[A]

Heavy optional reduce

Heavy optional reduce

Folds elements with a binary function

REDUCE_? is functionally equivalent to reduce_?, but is fully inlined. It makes compiled code larger, but guarantees the best possible performance on large streams.

Source
_aggregate.scala