Skip to content

Commit

Permalink
Build (17.0.9, 2.13.13) fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Roehler <[email protected]>
  • Loading branch information
andreas-roehler committed Sep 6, 2024
1 parent 0a22dc2 commit 7d0c6e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chapter02/worksheets/solution2.2.6.3_2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def zipWithIndex[A](xs: Seq[A]): Seq[(A, Int)] = {
type Acc = Seq[(A, Int)]
def init: Acc = Seq((xs.head, -1))
xs.foldLeft(init) { (x, y) => (y, x(0)(1) + 1) +: x }.reverse.tail
xs.foldLeft(init) { (x, y) => (y, x(0)._2 + 1) +: x }.reverse.tail
}

val expected: Seq[(String, Int)] = List(("a", 0), ("b", 1), ("c", 2), ("d", 3))
Expand Down

0 comments on commit 7d0c6e7

Please sign in to comment.