_extend

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

Def

@scala.annotation.targetName("join")
inline def +[A](inline v: A): ~[A]

Alias for join

Alias for join

Creates a new ~ with given element appended to current ~

  ((1 <> 5).~ + 99 + 100).tp

  // Output
  ~(1, 2, 3, 4, 5, 99, 100)
Source
_extend.scala
@scala.annotation.targetName("joinAll")
inline def ++[A](inline v: ~[A]): ~[A]

Alias for joinAll

Alias for joinAll

Creates a new ~ with given elements appended to current ~

  (('1' <> '9').~ ++ ('a' <> 'd') ++ ('A' <> 'D')).tp

  // Output
  ~(1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, A, B, C, D)
Source
_extend.scala
@scala.annotation.targetName("joinAllAt")
inline def ++@[A](inline index: Int, inline v: ~[A]): ~[A]

Alias for joinAllAt

Alias for joinAllAt

Creates a new ~ with given elements inserted into current Stream at given index

If index is out of range, the elements are prepended or appended

   (('a' <> 'f').~ ++@ (3, 'X' <> 'Z')).tp

   // Output
   ~(a, b, c, X, Y, Z, d, e, f)
Source
_extend.scala
@scala.annotation.targetName("joinAt")
inline def +@[A](inline index: Int, inline v: A): ~[A]

Alias for joinAt

Alias for joinAt

Creates a new ~ with given element inserted into current ~ at given index

If index is out of range, the element is prepended or appended

 (('a' <> 'd').~ +@ (2, 'X')).tp

  // Output
  ~(a, b, X, c, d)
Source
_extend.scala
inline def default[A](inline v: => A): ~[A]

Default element

Default element

If current ~ is empty, the given element will be appended

Otherwise current ~ will not change

 (1 <>> 1).~.default(99).tp // Prints ~(99)

 (1 <>> 5).~.default(99).tp // Prints ~(1, 2, 3, 4)
Source
_extend.scala
inline def join[A](inline v: A): ~[A]

Join element

Join element

Creates a new ~ with given element appended to current ~

  (1 <> 5).~.join(99).join(100).tp

  // Output
  ~(1, 2, 3, 4, 5, 99, 100)
Source
_extend.scala
inline def joinAll[A](inline v: ~[A]): ~[A]

Join all

Join all

Creates a new ~ with given elements appended to current ~

  ('1' <> '9').~.joinAll('a' <> 'd').joinAll('A' <> 'D').tp

  // Output
  ~(1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, A, B, C, D)
Source
_extend.scala
inline def joinAllAt[A](inline index: Int, inline v: ~[A]): ~[A]

Join all at position

Join all at position

Creates a new ~ with given elements inserted into current Stream at given index

If index is out of range, the elements are prepended or appended

   ('a' <> 'f').~.joinAllAt(3, 'X' <> 'Z').tp

   // Output
   ~(a, b, c, X, Y, Z, d, e, f)
Source
_extend.scala
inline def joinAt[A](inline index: Int, inline v: A): ~[A]

Join element at position

Join element at position

Creates a new ~ with given element inserted into current ~ at given index

If index is out of range, the element is prepended or appended

 ('a' <> 'd').~.joinAt(2, 'X').tp

  // Output
  ~(a, b, X, c, d)
Source
_extend.scala
inline def repeat[A](inline times: Int): ~[A]

Repeat elements

Repeat elements

Creates a new ~ where each elements from current ~ is repeated given number of times

 (0 <> 2).~.repeat(3).tp

 // Output
 ~(0, 0, 0, 1, 1, 1, 2, 2, 2)
Source
_extend.scala
inline def unfold[A](f: ~[A] => Opt[A]): ~[A]

Lazy generator

Lazy generator

Lazily unfolds next stream value with a function taking all prior values

If the given function returns void option, the stream ends

 // Unfolding Fibonacci Sequence

 (0 <> 1).~.unfold(_.takeLast(2).sum).takeFirst(20).tp

 // Output
 ~(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181)

Note: Method .takeFirst(20) is needed, because otherwise the stream will never end and would be hard to print out

Source
_extend.scala