~._use

trait _use extends _aggregate with _calculate with _evaluate with _print with _process with _read with _transformTo
trait _read
trait _process
trait _print
trait _evaluate
class Object
trait Matchable
class Any
object ~

Def

Inherited

@targetName("pack")
def ><[A]: ><[A]

Pack

Pack

Returns stream elements as Pack

Inherited from
_transformTo
Source
_transformTo.scala
@targetName("average")
def average[A](using v: ~.Custom.Math.Average[A]): A

Average

Average

Computes average

For empty Stream returns zero value

   (10 <> 15).~.map(_.Float).average  // Returns 12.5

Note: average is available for types providing given ~~.Custom.Math.Average implementations, which are by default Double, Float and opaque numerics based on Double and Float

Inherited from
_calculate
Source
_calculate.scala
@targetName("average_Opt")
def average_?[A](using v: ~.Custom.Math.Average[A]): Opt[A]

Average option

Average option

Computes average or returns void option for empty stream

   (10 <> 15).~.map(_.Float).average_?  // Returns Opt(12.5)

Note: average_? is available for types providing given ~~.Custom.Math.Average implementations, which are by default Double, Float and opaque numerics based on Double and Float

Inherited from
_calculate
Source
_calculate.scala
def averageFew[A](fb: A => Opt[B], fc: A => Opt[C], fd: A => Opt[D], fe: A => Opt[E], ff: A => Opt[F])(using nb: ~.Custom.Math.Average[B], nc: ~.Custom.Math.Average[C], nd: ~.Custom.Math.Average[D], ne: ~.Custom.Math.Average[E], nf: ~.Custom.Math.Average[F]): (B, C) | (B, C, D) | (B, C, D, E) | (B, C, D, E, F)

Multi average

Multi average

Simultaneously computes up to 5 average values for properties specified by functions

Returns tuple of appropriate size with values corresponding to the given mappings

For empty Stream returned tuple will hold zeros

   (1 <> 1000).~.averageFew(_ * 10F, _ * 100F).tp  // Prints (5005, 50050)

    val (first, second, third) = (1 <> 1000).~.averageFew(v => v.Double, _ * 10.0, _ * 100.0)

    first.tp     // Prints 5005
    second.tp    // Prints 5005
    third.tp     // Prints 5005

Note: Averages areavailable for types providing given Stream.Custom.Average implementations, which are by default Double, Float and opaque numerics based on Double and Float

Inherited from
_calculate
Source
_calculate.scala
def contains[A](value: A): Boolean

Value check

Value check

Returns true if stream contains given value.

Inherited from
_evaluate
Source
_evaluate.scala
def count[A](f: A => Boolean): Int

Conditional count

Conditional count

Counts all stream elements, which satisfy given predicate

Inherited from
_evaluate
Source
_evaluate.scala
def count[A]: Int

All count

All count

Counts all stream elements

Inherited from
_evaluate
Source
_evaluate.scala
def countAndTime[A]: (Int, Length)

Count and time

Count and time

Returns all elements count and Time.Length it took to pump the stream

  val (cnt,time) = (1 <> 1000).~.peek(_ => J.sleep(1.Millis)).countAndTime

  ("" + cnt + " elements processed in " + time.tag).tp

  // Output
  1000 elements processed in 1.488880500 sec
Inherited from
_evaluate
Source
_evaluate.scala
def countFew[A](f1: A => Boolean, f2: A => Boolean, f3: A => Boolean, f4: A => Boolean, f5: A => Boolean): (Int, Int) | (Int, Int, Int) | (Int, Int, Int, Int) | (Int, Int, Int, Int, Int)

Multi count

Multi count

Simultaneously counts values for up to 5 different predicates

Returns tuple of appropriate size with values corresponding to the given mappings

For empty Stream returned tuple will hold zeros

val (large, odd, even) = (1 <>> 1000).~.countFew(_ > 100, _ % 2 == 0, _ % 2 == 1)

large.tp    // Prints 899
odd.tp      // Prints 499
even.tp     // Prints 500
Inherited from
_evaluate
Source
_evaluate.scala
def drain[A]: Unit

Pump stream out

Pump stream out

Fetches and discards all stream elements

This operation can be usefull for side effects built into streaming pipeline

 ('A' <> 'C').~.peek(_.tp).drain

 // Output
 A
 B
 C
Inherited from
_process
Source
_process.scala
def equalsAll[A](v: ~[A]): Boolean

Equal check

Equal check

Iterates both streams and compares all corresponding elements

Returns true if all are equal, `false`` otherwise

Inherited from
_evaluate
Source
_evaluate.scala
@targetName("equalsAll_Result")
def equalsAll_??[A](v: ~[A]): Result[true]

Equal check

Equal check

Iterates both streams and compares all corresponding elements

When first not equal pair is found, the problem result is returned

If all elements are equal, Result[true] is returned

(0 <> 10).~.equalsAll_??(0 <> 10).tp
// Prints: Result(true)

(0 <> 10).~.equalsAll_??(0 <>> 10).tp
// Prints: Result(Problem(Second stream has less elements))

((0 <> 5).~ + 7 + 8).equalsAll_??(0 <> 10).tp
// Prints: Result(Problem(Fail at index 6: 7 != 6))

Note: The returned problem contains message with basic description

Inherited from
_evaluate
Source
_evaluate.scala
def equalsStart[A](v: ~[A]): Boolean

Equal start check

Equal start check

Checks if starting elements of two streams (to a point where one stream ends) are equal

Inherited from
_evaluate
Source
_evaluate.scala
@targetName("equalsStart_Result")
def equalsStart_??[A](v: ~[A]): Result[true]

Equal start check

Equal start check

Checks if starting elements of two streams (to a point where one stream ends) are equal

(0 <> 10).~.equalsStart_??(0 <> 1000).tp
// Prints: Result(true)

(0 <> 1000).~.equalsStart_??(0 <> 10).tp
// Prints: Result(true)

((0 <> 5).~ + 7 + 8).equalsStart_??(0 <> 10).tp
// Prints: Result(Problem(Fail at index 6: 7 != 6))

Note: The returned problem result contains message with basic description

Inherited from
_evaluate
Source
_evaluate.scala
def exists[A](f: A => Boolean): Boolean

Exists check

Exists check

Returns true if there is an elemnet satisfying given predicate

Inherited from
_evaluate
Source
_evaluate.scala
def find[A](f: A => Boolean): A

Find value

Find value

Finds the first value accepted by given predicate

 (1 <> 1000).~.find(_ > 100).tp  // Prints 101

Note: If value is not found find fails, use find_? in most cases

Inherited from
_evaluate
Source
_evaluate.scala
@targetName("find_Opt")
def find_?[A](f: A => Boolean): Opt[A]

Optional find value

Optional find value

Finds the first value accepted by given predicate or returns void option if not found

(1 <> 1000).~.find_?(_ > 100).tp   // Prints Opt(101)

(1 <> 10).~.find_?(_ > 100).tp     // Prints Opt(\/)
Inherited from
_evaluate
Source
_evaluate.scala
@targetName("findPosition_Opt")
def findPosition_?[A](f: A => Boolean): Opt

Find index

Find index

Optionally returns index for the first element satisfying the predicate or Int.Opt(/) if none found

  (50 <> 500).~.findPosition_?(_ == 400)  // Retuns Int.Opt(350)
Inherited from
_evaluate
Source
_evaluate.scala
def fold[A](start: A)(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

Inherited from
_aggregate
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.

Inherited from
_aggregate
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.

Inherited from
_aggregate
Source
_aggregate.scala
def foldAs[A](start: B)(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

Inherited from
_aggregate
Source
_aggregate.scala
inline def FOREACH[A](inline f: A => U): Unit

Heavy process stream

Heavy process stream

Applies given function to each stream element

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

Inherited from
_process
Source
_process.scala
def foreach[A](f: A => U): Unit

Process stream

Process stream

Applies given function to each stream element

 ('A' <> 'C').~.foreach(_.tp)

 // Output
 A
 B
 C
Inherited from
_process
Source
_process.scala
def foreachIndexed[A](f: (Int, A) => U, start: Int): Unit

For each indexed

For each indexed

Calls given function with counter

 ('A' <> 'C').~.foreachIndexed((i,v) => "Element " + i + " = " + v tp(), 1)

 // Output
 Element 1 = A
 Element 2 = B
 Element 3 = C
Value Params
start

starting value for indexing

Inherited from
_process
Source
_process.scala
def fornil[A](f: => U): Unit

Run for nonexistent value

Run for nonexistent value

Runs given function only if stream is empty.

This operation is rarely useful and is provided for consistency.

Use peekEmpty instead, it can be combined with other processing

Inherited from
_process
Source
_process.scala
def isEvery[A](f: A => Boolean): Boolean

Forall check

Forall check

Returns true if every single element satisfies the given predicate

Inherited from
_evaluate
Source
_evaluate.scala
def iterator[A]: Iterator[A]

Iterator view

Iterator view

Wraps current stream as scala.collection.Iterator

Inherited from
_transformTo
Source
_transformTo.scala
def last[A]: A

Last element

Last element

Returns the last stream element

Fails if empty

Inherited from
_evaluate
Source
_evaluate.scala
@targetName("last_Opt")
def last_?[A]: Opt[A]

Last element

Last element

Optionally returns the last element or Opt(/)

Inherited from
_evaluate
Source
_evaluate.scala
def makeString[A](sep: String)(using t: Info.Tag.Doc[A]): String

Convert ot String

Convert ot String

The result is a concatenation of all elements with given separator

   ('a' <> 'j').~.makeString()              // Returns abcdefghij

   ('a' <> 'j').~.makeString("|")           // Returns a|b|c|d|e|f|g|h|i|j

Inherited from
_transformTo
Source
_transformTo.scala
@targetName("max")
def max[A](using Ordering[A]): A

Maximum

Maximum

Computes maximum value

Fails for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("max_Opt")
def max_?[A](using c: Ordering[A]): Opt[A]

Optional maximum

Optional maximum

Computes maximum value or returns void option for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("maxBy")
def maxBy[A](f: A => B)(using Ordering[B]): A

Maximum by property

Maximum by property

Computes maximum value based on given function

Fails for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("maxBy_Opt")
def maxBy_?[A](f: A => B)(using c: Ordering[B]): Opt[A]

Optional maximum by property

Optional maximum by property

Computes maximum value based on given function or returns void option for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("min")
def min[A](using Ordering[A]): A

Minimum

Minimum

Computes minimum value

Fails for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("min_Opt")
def min_?[A](using c: Ordering[A]): Opt[A]

Optional minimum

Optional minimum

Computes minimum value or returns void option for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("minBy")
def minBy[A](f: A => B)(using Ordering[B]): A

Minimum by property

Minimum by property

Computes minimum value based on given function

Fails for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("minBy_Opt")
def minBy_?[A](f: A => B)(using c: Ordering[B]): Opt[A]

Optional minimum by property

Optional minimum by property

Computes minimum value based on given function or returns void option for empty streams

Inherited from
_calculate
Source
_calculate.scala
def printId[A](using Info.Tag.Doc[A]): Unit

Print to console with rows indexed

Print to console with rows indexed

Same as regular print, but with added index as first column identifying the object


('A' <> 'F').~.map(v => (v.Int, v)).print

// Output
----------------- -- --
Id                _1 _2
----------------- -- --
scala.Tuple2@dzkr 65 A
scala.Tuple2@zn1  66 B
scala.Tuple2@71j3 67 C
scala.Tuple2@562u 68 D
scala.Tuple2@c8tt 69 E
scala.Tuple2@p0m8 70 F
----------------- -- --
Inherited from
_print
Source
_print.scala
def process[A](foreachFun: A => U, fornilFun: => W): Unit

Process elements or empty case

Process elements or empty case

Applies given function to each stream element or runs second function when stream is empty

 ('A' <>> 'A').~.process(_.tp, "Empty".tp)

 // Output
 Empty
Inherited from
_process
Source
_process.scala
@targetName("range")
def range[A](using Ordering[A]): <>[A]

Range

Range

Computes value range

Fails for empty streams

Inherited from
_calculate
Source
_calculate.scala
@targetName("range_Opt")
def range_?[A](using c: Ordering[A]): Opt[<>[A]]

Optional range

Optional range

Computes value value or returns void option for empty streams

Inherited from
_calculate
Source
_calculate.scala
inline def read[A]: A

Next element

Next element

Delivers next stream element

 val s : ~[Char] = 'A' <> 'Z'

 s.read.tp  // Prints A
 s.read.tp  // Prints B
 s.read.tp  // Prints C

Note: If stream is empty, read will fail. So, use a safer read_? in most cases

Inherited from
_read
Source
_read.scala
@targetName("read_Stream")
inline def read_~[A](inline cnt: Int): ~[A] & Size

Read many elements

Read many elements

Immediatelly removes given number of elements from current stream and returns them as a new stream

 val s : ~[Int] = 1 <> 12

 s.read_~(3).tp  // Prints ~(1, 2, 3)
 s.read_~(4).tp  // Prints ~(4, 5, 6, 7)
 s.read_~(7).tp  // Prints ~(8, 9, 10, 11, 12)
 s.read_~(8).tp  // Prints ~()

Note: If requested number of elements is not available, the number returned is less (0 if empty)

Inherited from
_read
Source
_read.scala
@targetName("read_Opt")
inline def read_?[A]: Opt[A]

Next optional element

Next optional element

Delivers next stream element or void option if stream is empty

 val s : ~[Char] = 'A' <> 'C'

 s.read_?.tp  // Prints Opt(A)
 s.read_?.tp  // Prints Opt(B)
 s.read_?.tp  // Prints Opt(C)
 s.read_?.tp  // Prints Opt(\/)
Inherited from
_read
Source
_read.scala
def reduce[A](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

Inherited from
_aggregate
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.

Inherited from
_aggregate
Source
_aggregate.scala
@targetName("reduce_Opt")
def reduce_?[A](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

Inherited from
_aggregate
Source
_aggregate.scala
@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.

Inherited from
_aggregate
Source
_aggregate.scala
@targetName("sum")
def sum[A](using n: Math[A]): A

Sum

Sum

Calculates sum of all values

For empty stream returns zero

    (1 <> 1000).~.sum.tp // Prints 500500
Inherited from
_calculate
Source
_calculate.scala
@targetName("sum_Opt")
def sum_?[A](using n: Math[A]): Opt[A]

Optional sum

Optional sum

Calculates sum of all values or returns void option for empty streams

    (1 <> 1000).~.sum_?.tp // Prints Opt(500500)
Inherited from
_calculate
Source
_calculate.scala
def sumFew[A](fb: A => Opt[B], fc: A => Opt[C], fd: A => Opt[D], fe: A => Opt[E], ff: A => Opt[F])(using nb: Math[B], nc: Math[C], nd: Math[D], ne: Math[E], nf: Math[F]): (B, C) | (B, C, D) | (B, C, D, E) | (B, C, D, E, F)

Multi sum

Multi sum

Simultaneously computes up to 5 sum values for properties specified by given functions

Returns tuple of appropriate size with values corresponding to the given mappings

For empty Stream returned tuple will hold zeros

 (1 <> 1000).~.sumFew(_ * 10, _ * 100).tp  // Prints (5005000, 50050000)

 val (first, second, third) = (1 <> 1000).~.sumFew(v => v, _ * 10, _ * 100)

 first.tp     // Prints 500500
 second.tp    // Prints 5005000
 third.tp     // Prints 50050000
Inherited from
_calculate
Source
_calculate.scala
def toArray[A](using ClassTag[A]): Array[A]

Convert to Array

Convert to Array

Returns stream elements as Array

 val a : Array[Int] =  (1 <> 10).~.toArray
Inherited from
_transformTo
Source
_transformTo.scala
def toBuffer[A]: Buffer[A]

Convert to Buffer

Convert to Buffer

Returns stream elements as Buffer

Inherited from
_transformTo
Source
_transformTo.scala
def toIdx[A]: Idx[A]

Convert to Idx

Convert to Idx

Returns stream elements as Idx

Inherited from
_transformTo
Source
_transformTo.scala
inline def toJavaIterator[A]: Iterator[A]

Convert to Java Iterator

Convert to Java Iterator

Wraps current stream as java.util.Iterator

Inherited from
_transformTo
Source
_transformTo.scala
def toJavaList[A]: List[A]

Convert to Java List

Convert to Java List

Returns stream elements as java.util.List

Inherited from
_transformTo
Source
_transformTo.scala
inline def toJavaSpliterator[A](inline splitSize: Int): Spliterator[A]

Convert to Java Spliterator

Convert to Java Spliterator

Wraps current stream as java.util.Spliterator

Inherited from
_transformTo
Source
_transformTo.scala
def toJavaStream[A](parallel: Boolean): Stream[A]

Convert to Java Stream

Convert to Java Stream

Wraps current stream as java.util.stream.Stream

Inherited from
_transformTo
Source
_transformTo.scala
def toList[A]: List[A]

Convert to List

Convert to List

Returns stream elements as scala.collection.immutable.List

Inherited from
_transformTo
Source
_transformTo.scala
def toLookup[A, B]: Lookup[A, B]

Convert to Lookup

Convert to Lookup

Returns a stream of tuples with (Key,Value) pairs as Lookup

val intLookup : Lookup[Int,Char] = ('A' <> 'F').~.zipKey(_.Int).toLookup

intLookup.pair_~.tp   // Prints ~((69,E), (70,F), (65,A), (66,B), (67,C), (68,D))

val charLookup : Lookup[Char,Int] = ('A' <> 'F').~.zipValue(_.Int).toLookup

charLookup.pair_~.tp   // Prints ~((E,69), (F,70), (A,65), (B,66), (C,67), (D,68))
Inherited from
_transformTo
Source
_transformTo.scala
def toLookupBy[A](f: A => K): Lookup[K, A]
Inherited from
_transformTo
Source
_transformTo.scala
def toMap[A, B]: Map[A, B]
Inherited from
_transformTo
Source
_transformTo.scala
def toMapBy[A](f: A => K): Map[K, A]
Inherited from
_transformTo
Source
_transformTo.scala
def toProduct[A]: Product

Convert to Product

Convert to Product

Returns stream elements as scala.Product

Inherited from
_transformTo
Source
_transformTo.scala
def toSeq[A]: IndexedSeq[A]

Convert to Seq

Convert to Seq

Returns stream elements as scala.collection.immutable.IndexedSeq

Inherited from
_transformTo
Source
_transformTo.scala
def toSet[A]: StableSet[A]

Convert to unique collection

Convert to unique collection

Returns stream elements as StableSet

Inherited from
_transformTo
Source
_transformTo.scala
def toText[A](using t: Info.Tag.Doc[A]): String

Elements as multi-line String

Elements as multi-line String

Returns all elements as String formatted table

If elements implement Able.Info, each 'info' property value is placed in a different column

If elements implement scala.Product (like all Tuples), each Product element is placed in a different column

  ('a' <> 'e').~.map(v => (v + "1", v + "2", v + "3", v + "4", v + "5")).tp

  // Output
  -- -- -- -- --
  ?  ?  ?  ?  ?
  -- -- -- -- --
  a1 a2 a3 a4 a5
  b1 b2 b3 b4 b5
  c1 c2 c3 c4 c5
  d1 d2 d3 d4 d5
  e1 e2 e3 e4 e5
  -- -- -- -- --
Inherited from
_transformTo
Source
_transformTo.scala
def toVector[A]: Vector[A]

Convert to Vector

Convert to Vector

Returns stream elements as scala.collection.immutable.Vector

Inherited from
_transformTo
Source
_transformTo.scala