Skip to content

Instantly share code, notes, and snippets.

@baisong
Forked from rgabo/README.md
Created July 5, 2011 12:17
Show Gist options
  • Save baisong/1064733 to your computer and use it in GitHub Desktop.
Save baisong/1064733 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