Skip to content

Instantly share code, notes, and snippets.

@michalkowol
Last active December 29, 2015 13:59
Show Gist options
  • Save michalkowol/7681243 to your computer and use it in GitHub Desktop.
Save michalkowol/7681243 to your computer and use it in GitHub Desktop.
def isSorted[A](as: List[A], gt: (A, A) => Boolean): Boolean = as match {
case a :: b :: tail => {
if (!gt(a, b)) return false
isSorted(b :: tail, gt)
}
case _ => true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment