Created
November 9, 2011 12:57
-
-
Save seratch/1351348 to your computer and use it in GitHub Desktop.
example2.scala #daimonscala 21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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