Hacker News new | past | comments | ask | show | jobs | submit login

Haskell has sortBy and comparing, like this:

    sortBy (comparing salary) employees
The grammar is not as close to English, but close enough to understand.



The canonical example there is actually to use on and infix `` notation:

    sortBy (compare `on` salary) employeers




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: