3 ms·
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 alterna
by ufo 15y ago
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.
- telemachos 15y ago> 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 http://en.wikipedia.org/wiki/Schwartzian_transform