ascend sort using a function call