Skip to content

Instantly share code, notes, and snippets.

@seratch
Created November 9, 2011 12:57
Show Gist options
  • Save seratch/1351348 to your computer and use it in GitHub Desktop.
Save seratch/1351348 to your computer and use it in GitHub Desktop.
example2.scala #daimonscala 21
val arr = Array(1,5,3,2,4)
val res = arr.sortWith { (i1,i2) => i1 < i2 }
res foreach println
val compare = (i1:Int, i2:Int) => i1 < i2
val res = arr.sortWith(compare)
def compare(i1:Int, i2:Int) = i1 < i2
val res = arr sortWith compare _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment