Skip to content

Instantly share code, notes, and snippets.

@yuya-takeyama
Created May 19, 2011 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yuya-takeyama/981297 to your computer and use it in GitHub Desktop.
Save yuya-takeyama/981297 to your computer and use it in GitHub Desktop.
quick sleep sort

quick sleep sort

example usage:

$ coffee quicksleepsort.coffee 3701 45 292 9 324 45 23 123 1343
9
23
45
45
123
292
324
1343
3701
sleepsort = (list, callback) ->
if typeof callback == 'undefined'
callback = (n) -> console.log n
f = (n) ->
setTimeout ->
callback n
, n
for i in list
f i
sleepsort process.argv.slice(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment