Skip to content
Permalink
Browse files

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
  • Loading branch information...
slashdev1 committed Jun 18, 2019
1 parent 08a29e1 commit 13101ac75711bfc14f0c9a0bdcba70095f94a092
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/main/scala/fpinscalalib/GettingStartedWithFPSection.scala
@@ -56,7 +56,7 @@ object GettingStartedWithFPSection
@annotation.tailrec
def go(n: Int): Boolean =
if (n >= as.length - 1) true
else if (ordering(as(n), as(n + 1))) false
else if (!ordering(as(n), as(n + 1))) false
else go(n + 1)

go(0)

0 comments on commit 13101ac

Please sign in to comment.
You can’t perform that action at this time.