... until the collector arrives ...
Here is Gosling's tricky sort, ported from Pascal to Javascript. Or was it from Pyxis? I can't remember...