Created
March 27, 2013 21:26
-
-
Save dmotz/5258164 to your computer and use it in GitHub Desktop.
recursive sort in 3 lines of coffee
This file contains 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
sort = (l) -> | |
return [] unless l.length | |
h = l.shift() | |
(sort (x for x in l when x <= h)).concat([h]).concat sort (x for x in l when x > h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment