Advertisement
Guest User

Untitled

a guest
Jun 9th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.21 KB | None | 0 0
  1.   def isSorted[A](collection: Array[A], gt: (A, A) => Boolean): Boolean = {
  2.     def geq(a: A, b: A): Boolean = gt(a, b) || (!gt(a, b) && !gt(b, a))
  3.     (collection.init, collection.tail).zipped.forall(geq)
  4.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement