Skip to content

Commit 13101ac

Browse files
authored
Update GettingStartedWithFPSection.scala
I mean function isSorted has a mistake because isSorted(Array(1, 3, 5, 7), (x: Int, y: Int) => x > y) should be return false: first step 1 > 3 is false
1 parent 08a29e1 commit 13101ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/fpinscalalib/GettingStartedWithFPSection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ 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)

0 commit comments

Comments
 (0)