_evaluate

trait _evaluate[A]
class java.lang.Object
trait scala.Matchable
class Any
trait _use
object Stream

Def

inline def contains(value: A): Boolean

Value check

Value check

Returns true if stream contains given value.

Source
_evaluate.scala
inline def containsSequence(seq: Stream[A]): Boolean

Sequence check

Sequence check

Returns true if stream contains given sequence of values.

Source
_evaluate.scala
inline def count: Int

All count

All count

Counts all stream elements

Source
_evaluate.scala
inline def count(f: A => Boolean): Int

Conditional count

Conditional count

Counts all stream elements, which satisfy given predicate

Source
_evaluate.scala
inline def countAndTime: (Int, Time.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).stream.peek(_ => J.sleep(1.Millis)).countAndTime

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

  // Output
  1000 elements processed in 1.488880500 sec
Source
_evaluate.scala
inline def countFew[B,C,D,E,F](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).stream.countFew(_ > 100, _ % 2 == 0, _ % 2 == 1)

large.tp    // Prints 899
odd.tp      // Prints 499
even.tp     // Prints 500
Source
_evaluate.scala
inline def equalsSequence(v: Stream[A]): Boolean

Equal check

Equal check

Iterates both streams and compares all corresponding elements

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

Source
_evaluate.scala
inline def equalsSequenceResult(v: Stream[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).stream.equalsAllResult(0 <> 10).tp
// Prints: Result(true)

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

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

Note: The returned problem contains message with basic description

Source
_evaluate.scala
inline def exists(f: A => Boolean): Boolean

Exists check

Exists check

Returns true if there is an elemnet satisfying given predicate

Source
_evaluate.scala
inline def find(f: A => Boolean): A

Find value

Find value

Finds the first value accepted by given predicate

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

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

Source
_evaluate.scala
inline def findOpt(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).stream.findOpt(_ > 100).tp   // Prints Opt(101)

(1 <> 10).stream.findOpt(_ > 100).tp     // Prints Opt(VOID)
Source
_evaluate.scala
inline def findPositionOpt(f: A => Boolean): Int.Opt

Find index

Find index

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

  (50 <> 500).stream.findPositionOpt(_ == 400)  // Retuns Int.Opt(350)
Source
_evaluate.scala

Find start index

Find start index

Optionally returns index where given stream value sequence matches current stream values

Source
_evaluate.scala
inline def isEvery(f: A => Boolean): Boolean

Forall check

Forall check

Returns true if every single element satisfies the given predicate

Source
_evaluate.scala
inline def last: A

Last element

Last element

Returns the last stream element

Fails if empty

Source
_evaluate.scala
inline def lastOpt: Opt[A]

Last element

Last element

Optionally returns the last element or Opt(VOID)

Source
_evaluate.scala
inline def startsWithSequence(v: Stream[A]): Boolean

Equal start check

Equal start check

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

Source
_evaluate.scala
inline def startsWithSequenceResult(v: Stream[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).stream.equalsStartResult(0 <> 1000).tp
// Prints: Result(true)

(0 <> 1000).stream.equalsStartResult(0 <> 10).tp
// Prints: Result(true)

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

Note: The returned problem result contains message with basic description

Source
_evaluate.scala