Skip to content

Commit

Permalink
Fix off-by-one error with segments
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Oct 23, 2024
1 parent 003d743 commit 0349ab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/rudiments.Segmentable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import anticipation.*

object Segmentable:
given [ElementType] => IndexedSeq[ElementType] is Segmentable =
(seq, interval) => seq.slice(interval.start.n0, interval.end.n1)
(seq, interval) => seq.slice(interval.start.n0, interval.end.n0)

given [ElementType] => IArray[ElementType] is Segmentable as iarray =
(iarray, interval) => iarray.slice(interval.start.n0, interval.end.n1)
(iarray, interval) => iarray.slice(interval.start.n0, interval.end.n0)

given Text is Segmentable = (text, interval) =>
text.s.substring(interval.start.n0, interval.end.n1).nn.tt
text.s.substring(interval.start.n0, interval.end.n0).nn.tt

trait Segmentable:
type Self
Expand Down
2 changes: 1 addition & 1 deletion src/core/soundness+rudiments-core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export rudiments.{ByteSize, bin, hex, Hex, b, kb, mb, gb, tb, byteSize, sift, ha
Exit, Pid, Quickstart, Nat, Label, unit, waive, twin, triple, is, matchable, give, pipe,
tap, also, Counter, loop, Loop, &, tuple, to, WorkingDirectoryError, HomeDirectoryError,
WorkingDirectory, HomeDirectory, workingDirectory, homeDirectory, Bond, binds, bound, prim, sec,
ter, unwind, at, Indexable, yet, Capability, Bijection, bijection}
ter, unwind, at, Indexable, yet, Capability, Bijection, bijection, segment, Segmentable}

package quickstart:
export rudiments.quickstart.defaults as defaults
Expand Down

0 comments on commit 0349ab2

Please sign in to comment.