Skip to content

Instantly share code, notes, and snippets.

@dmotz
Created March 27, 2013 21:26
Show Gist options
  • Save dmotz/5258164 to your computer and use it in GitHub Desktop.
Save dmotz/5258164 to your computer and use it in GitHub Desktop.
recursive sort in 3 lines of coffee
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