io.github.scala_tessella.ring_seq

Contains RingSeq and usage examples.

Attributes

Members list

Packages

Contains examples of using RingSeq.

Contains examples of using RingSeq.

Attributes

Type members

Classlikes

trait ComparingOps extends IteratingOps

Provides comparison operations for a Seq considered circular.

Provides comparison operations for a Seq considered circular.

Attributes

Supertypes
trait IteratingOps
trait SlicingOps
trait IndexingOps
class Object
trait Matchable
class Any
Show all
Known subtypes
trait NecklaceOps
object RingSeq
trait IndexingOps

Provides indexing operations for a Seq considered circular.

Provides indexing operations for a Seq considered circular.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object SymmetryOps
trait SlicingOps
trait IteratingOps
trait ComparingOps
trait NecklaceOps
object RingSeq
trait SymmetryOps
Show all
trait IteratingOps extends SlicingOps

Provides operations returning iterators of sequences for a Seq considered circular.

Provides operations returning iterators of sequences for a Seq considered circular.

Attributes

Supertypes
trait SlicingOps
trait IndexingOps
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ComparingOps
trait NecklaceOps
object RingSeq
object NecklaceOps

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait NecklaceOps extends ComparingOps

Provides canonical-form operations for a Seq considered circular.

Provides canonical-form operations for a Seq considered circular.

Attributes

Companion
object
Supertypes
trait ComparingOps
trait IteratingOps
trait SlicingOps
trait IndexingOps
class Object
trait Matchable
class Any
Show all
Known subtypes
object RingSeq
object RingSeq extends NecklaceOps, SymmetryOps

Adds implicit methods to scala.collection.Seq (immutable / mutable and subtypes) for when a sequence needs to be considered circular, its elements forming a ring.

Adds implicit methods to scala.collection.Seq (immutable / mutable and subtypes) for when a sequence needs to be considered circular, its elements forming a ring.

Attributes

Supertypes
trait SymmetryOps
trait NecklaceOps
trait ComparingOps
trait IteratingOps
trait SlicingOps
trait IndexingOps
class Object
trait Matchable
class Any
Show all
Self type
RingSeq.type
final class RingView[A]

A lazy '''view''' of a sequence considered circular.

A lazy '''view''' of a sequence considered circular.

A RingView never copies its elements: it wraps an IndexedSeq together with a rotation offset and a reflected flag, so rotateRight, rotateLeft, startAt, reflectAt and reverse are all O(1) — they return a new view over the same underlying sequence. In particular rotations and rotationsAndReflections produce views in O(1) each, so pipelines like seq.ring.rotations.exists(...) short-circuit without materializing anything.

Because RingView is its own type (not a Seq), the circular operations carry their plain names — no O suffix is needed: seq.ring.slice(-1, 4), seq.ring.sliding(2), and indexing wraps in both directions.

Materialize at the boundary with toSeq, toVector, to or iterator.

Obtain a view with the ring method added to every Seq (and String) by import RingSeq._:

Vector(0, 1, 2, 3).ring.rotateRight(1).toVector // Vector(3, 0, 1, 2)

Attributes

Note

a view over a mutable sequence reflects later mutations of it, exactly like the standard library views. A non-indexed source (e.g. List) is copied once to a Vector on creation.

Companion
object
Supertypes
class Object
trait Matchable
class Any
object RingView

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
RingView.type
trait SlicingOps extends TransformingOps

Provides slicing operations for a Seq considered circular.

Provides slicing operations for a Seq considered circular.

Attributes

Supertypes
trait IndexingOps
class Object
trait Matchable
class Any
Known subtypes
trait IteratingOps
trait ComparingOps
trait NecklaceOps
object RingSeq
object SymmetryOps extends IndexingOps

Attributes

Companion
trait
Supertypes
trait IndexingOps
class Object
trait Matchable
class Any
Self type

Provides symmetry operations for a Seq considered circular.

Provides symmetry operations for a Seq considered circular.

Attributes

Companion
object
Supertypes
trait IndexingOps
class Object
trait Matchable
class Any
Known subtypes
object RingSeq

Provides rotation and reflection operations for a Seq considered circular.

Provides rotation and reflection operations for a Seq considered circular.

Attributes

Supertypes
trait IndexingOps
class Object
trait Matchable
class Any
Known subtypes
trait SlicingOps
trait IteratingOps
trait ComparingOps
trait NecklaceOps
object RingSeq
trait SymmetryOps
Show all