Skip to content

Commit 537513f

Browse files
author
Javier de Siloniz Sandino
committed
fix
1 parent 153376f commit 537513f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/scala/fpinscalalib/GettingStartedWithFPSection.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ object GettingStartedWithFPSection
5656
@annotation.tailrec
5757
def go(n: Int): Boolean =
5858
if (n >= as.length - 1) true
59-
else if (ordering(as(n), as(n + 1))) false
59+
else if (!ordering(as(n), as(n + 1))) false
6060
else go(n + 1)
6161

6262
go(0)
6363
}
6464

65-
isSorted(Array(1, 3, 5, 7), (x: Int, y: Int) => x > y) shouldBe res0
66-
isSorted(Array(7, 5, 1, 3), (x: Int, y: Int) => x < y) shouldBe res1
65+
isSorted(Array(1, 3, 5, 7), (x: Int, y: Int) => x < y) shouldBe res0
66+
isSorted(Array(7, 5, 1, 3), (x: Int, y: Int) => x > y) shouldBe res1
6767
isSorted(Array("Scala", "Exercises"), (x: String, y: String) => x.length > y.length) shouldBe res2
6868
}
6969

0 commit comments

Comments
 (0)