Skip to content

Commit 1a32274

Browse files
committed
Fix for long range count
Signed-off-by: James Hamlin <jfhamlin@gmail.com>
1 parent 24a46ff commit 1a32274

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/lang/equals_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestEquiv(t *testing.T) {
2020
{NewMap(1, 2).Seq(), NewVector(NewList(1, 2)), NewList(NewVector(1, 2))},
2121
// empty lazy seqs are equal
2222
{NewLazySeq(func() interface{} { return nil }), NewLazySeq(func() interface{} { return nil })},
23+
{NewList(1, 2), NewLongRange(0, 3, 1).Next()},
2324
}
2425

2526
for _, els := range equivs {

pkg/lang/longrange.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (r *LongRange) Next() ISeq {
104104
if next >= r.end {
105105
return nil
106106
}
107-
return &LongRange{start: next, end: r.end, step: r.step}
107+
return &LongRange{start: next, end: r.end, step: r.step, count: r.count - 1}
108108
}
109109

110110
func (r *LongRange) More() ISeq {

0 commit comments

Comments
 (0)