robb/Underscore.m — pull request #25 by robb (2013-01-09 14:02:04+00:00)
Title: Add Sorting

(This replaces #24 which was based against master)

@amiel:

I mistakenly changed the test in 864008628a620cb409a0c3220ef809d301db5eee, see the comment there.

The intention of `USAssertEqualObjects` is to compare functional style methods to their equivalent chaining style. For asserting the expecting results, please use `STAssertEqualObjects` with an appropriate description.

I think `sortAscending` should be called `compare` to better communicate that it will simply call `compare:` on the passed in objects. Since Objective-C does not have generics, there is no good way to enforce that the objects actually respond to that selector. Let's be at least clear about what's going on behind the scenes.

Regarding `sortDescending`, I think a `reverse` helper block would prove to be more flexible. What do you think? I could also live with leaving it out entirely since you really just need to

```objective-c
_.sort(array, ^(id a, id b){ [b compare:a]; }); // Return type inference FTW!
```