Skip to content

Commit

Permalink
Fix off-by-one error in 'foreachIndex'
Browse files Browse the repository at this point in the history
  • Loading branch information
jiribenes committed Jan 16, 2024
1 parent c1f0dfd commit 29819d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libraries/chez/common/immutable/list.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def foreach[A](l: List[A]) { f: A => Unit / Control } : Unit = {
// O(N)
def foreachIndex[A](list: List[A]){ f: (Int, A) => Unit / Control }: Unit = {
var remainder = list
var i = 0
var i = -1
loop {
if (not(remainder.isEmpty)) {
remainder match {
Expand Down
2 changes: 1 addition & 1 deletion libraries/js/immutable/list.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def foreach[A](l: List[A]) { f: A => Unit / Control } : Unit = {
// O(N)
def foreachIndex[A](list: List[A]){ f: (Int, A) => Unit / Control }: Unit = {
var remainder = list
var i = 0
var i = -1
loop {
if (not(remainder.isEmpty)) {
remainder match {
Expand Down

0 comments on commit 29819d5

Please sign in to comment.