Skip to content

Instantly share code, notes, and snippets.

@rgabo
Created July 5, 2011 07:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rgabo/1064435 to your computer and use it in GitHub Desktop.
Save rgabo/1064435 to your computer and use it in GitHub Desktop.
CoffeeScript / Node.js - ticksort

Node.js ticksort in CoffeeScript!

Beating your sleepsort by magnitudes! Takes only SUM(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