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.
Created
July 5, 2011 07:57
-
-
Save rgabo/1064435 to your computer and use it in GitHub Desktop.
CoffeeScript / Node.js - ticksort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((d)->(t=->return p.nextTick(t)if d--;console.log(i))())(i)for i in(a=(p=process).argv)[2..a.length] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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