_drop

trait _drop
class java.lang.Object
trait scala.Matchable
class Any
trait _filter
trait _build
object ~

Def

inline def drop[A](inline f: A => Boolean): ~[A]

Reverse filter

Reverse filter

Disallows ~ elements satisfying the given function

  (0 <>> 10).~.drop(_ > 5).tp

  // Output
  ~(0, 1, 2, 3, 4, 5)

Note: Scala equivalent is called "filterNot"

Source
_drop.scala
inline def DROP[A](inline f: A => Boolean): ~[A]

Heavy reversed filter

Heavy reversed filter

Disallows ~ elements satisfying the given function

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

Source
_drop.scala
@scala.annotation.targetName("drop_Range")
inline def drop_<>[A](inline i: Int.<>): ~[A]

Range reversed filter

Range reversed filter

Only allows elements outside specified sequencial range

  ('a' <> 'f').~.drop_<>(2 <> 3).tp

  // Output
  ~(a, b, e, f)

Note: Sequence indexing starts from 0

Source
_drop.scala
def dropAll[A](v: ~[A]): ~[A]

Multi element reversed filter

Multi element reversed filter

Only lets elements not found in given stream

  ('a' <> 'z').~.dropAll('c' <> 'x') .tp       // Prints ~(a, b, y, z)
Source
_drop.scala
def dropAllBy[A](f: A => B, v: ~[B]): ~[A]

Multi element mapped reversed filter

Multi element mapped reversed filter

Only lets elements, which mapped value is not found in given stream

  ('a' <> 'z').~.dropAllBy(_.Int % 10, ~~(1,3,7,4,6)).tp

  // Output
  ~(b, c, d, f, i, l, m, n, p, s, v, w, x, z)
Source
_drop.scala
inline def dropEvery[A](nTh: Int): ~[A]

Every Nth element reversed filter

Every Nth element reversed filter

Drops every nTh element

  (1 <> 10).~.dropEvery(3).tp   // Prints: ~(1, 2, 4, 5, 7, 8, 10)
Source
_drop.scala
inline def dropFirst[A](inline n: Int): ~[A]

Head reversed filter

Head reversed filter

Drops given number of first elements

  (1 <> 10).~.dropFirst(3).tp  // Prints  ~(4, 5, 6, 7, 8, 9, 10)
Source
_drop.scala
inline def dropLast[A](n: Int): ~[A]

Tail reversed filter

Tail reversed filter

Drops given number of elements coming last

  (1 <> 10).~.dropLast(3).tp  // Prints  ~(1, 2, 3, 4, 5, 6, 7)

Note: This method will block on unlimited streams

Source
_drop.scala
def dropOnly[A](v: A, vs: A*): ~[A]

Single value reversed filter

Single value reversed filter

Drops only specified value.

  (1 <> 4).~.dropOnly(3).tp

  // Output
  ~(1, 2, 4)

Note: dropOnly is more efficient than general filter, because there is no function involved.

Source
_drop.scala
def dropOnlyBy[A](f: A => B, vs: B*): ~[A]
inline def dropSame[A]: ~[A]

Duplicates reversed filter

Duplicates reversed filter

Drops elements equal to the passed in prior position

Note: To generally get rid of all duplicates, the stream must be sorted to arrange duplicates in sequence

Source
_drop.scala
inline def dropSameBy[A](inline f: A => B): ~[A]

Mapped duplicates reversed filter

Mapped duplicates reversed filter

Drops elements, which evaluate to the same value as elements passed in prior position

Note: To generally get rid of all duplicates, the stream must be sorted by the mapping function

  (1 <> 100).~.dropSameBy(_.toString.length).tp

  // Output
  ~(1, 10, 100)
Source
_drop.scala
def dropVoid[A](using Given.VoidTag[A]): ~[A]

Void value reversed filter

Void value reversed filter

Drops elements which test to be void

Source
_drop.scala
inline def dropWhile[A](inline f: A => Boolean): ~[A]

Coditional reversed head filter

Coditional reversed head filter

Discards first consecutive elements satisfying the condition

  def stream = (1 <> 5).~ ++ (1 <> 5)

  stream.tp                     // Prints ~(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)

  stream.dropWhile(_ <= 3).tp   // Prints ~(4, 5, 1, 2, 3, 4, 5)

Note: Everything starting from the first non compliant element will be allowed (including later compliant elements)

Source
_drop.scala