Implement the Pigeonhole sort. This is a variant of the Bucket sort, and its logic is very simple: index your items (by a given function) and then return all non-empty indexes' items.
Your program/function should get an array of items in the most comfortable way for your language of choice, (i.e. a parameter, stdin, etc.), and in any format you like (for example: JSON). It should return/output a sorted array.
Do not modify the given array.
The second parameter that will be given to your program/function will be the "sort-by function". For exmaple, in JavaScript it will be something like function(item){return item.id;}
.
For simplicity, you can assume this function returns a unique positive Integer for each item in the given array.
Shortest code wins. Only ASCII is allowed.