Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The pattern you mention of using a tuple of key-value pairs is not that bad and it even has a name. The Perl people call it the Swartzian transform.

An alternative if you don't like that would be having the maximum-finding function receive an additional comparator argument, similarly to qsort.



> The Perl people call it the Swartzian transform.

Yup, though one small thing: it's 'Schwartzian transform'[1] for Randal Schwartz.

[1] http://en.wikipedia.org/wiki/Schwartzian_transform




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

Search: