io.github.scala_tessella.ring_seq
Contains RingSeq and usage examples.
Attributes
Members list
Packages
Type members
Classlikes
Provides comparison operations for a Seq considered circular.
Provides comparison operations for a Seq considered circular.
Attributes
- Supertypes
-
trait IteratingOpstrait SlicingOpstrait TransformingOpstrait IndexingOpsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait NecklaceOpsobject RingSeq
Provides indexing operations for a Seq considered circular.
Provides indexing operations for a Seq considered circular.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object SymmetryOpstrait TransformingOpstrait SlicingOpstrait IteratingOpstrait ComparingOpstrait NecklaceOpsobject RingSeqtrait SymmetryOpsShow all
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 SlicingOpstrait TransformingOpstrait IndexingOpsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NecklaceOps.type
Provides canonical-form operations for a Seq considered circular.
Provides canonical-form operations for a Seq considered circular.
Attributes
- Companion
- object
- Supertypes
-
trait ComparingOpstrait IteratingOpstrait SlicingOpstrait TransformingOpstrait IndexingOpsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object RingSeq
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 SymmetryOpstrait NecklaceOpstrait ComparingOpstrait IteratingOpstrait SlicingOpstrait TransformingOpstrait IndexingOpsclass Objecttrait Matchableclass AnyShow all
- Self type
-
RingSeq.type
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 aVectoron creation. - Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Provides slicing operations for a Seq considered circular.
Provides slicing operations for a Seq considered circular.
Attributes
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
- Self type
-
SymmetryOps.type
Provides symmetry operations for a Seq considered circular.
Provides symmetry operations for a Seq considered circular.
Attributes
Provides rotation and reflection operations for a Seq considered circular.
Provides rotation and reflection operations for a Seq considered circular.
Attributes
- Supertypes
- Known subtypes
-
trait SlicingOpstrait IteratingOpstrait ComparingOpstrait NecklaceOpsobject RingSeqtrait SymmetryOpsShow all