Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created July 5, 2011 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evandrix/1064868 to your computer and use it in GitHub Desktop.
Save evandrix/1064868 to your computer and use it in GitHub Desktop.
Node.js ticksort in CoffeeScript!
Beating your sleepsort by magnitudes! Takes only MAX(argv) ticks and does not overflow the stack either.
Fork the gist if you can reduce the size of ticksort.coffee.
((d)->(t=->return p.nextTick(t)if d--;console.log(i))())(i)for i in(a=(p=process).argv)[2..a.length]
$ coffee ticksort.coffee 42 69 7 3117 1024
7
42
69
1024
3117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment