On Dec 7, 9:23 pm, Andy Fingerhut <[email protected]> wrote: > On Wed, Dec 7, 2011 at 8:29 PM, Alan Malloy <[email protected]> wrote: > > On Dec 7, 8:12 pm, Andy Fingerhut <[email protected]> wrote: > > > Ugh. And if I were slightly lazier at pressing the send button, I would > > > have realized that the laziness of map and remove gives this > > short-circuit > > > evaluation. > > > > I generalized your example to allow the notation [- keyfn] as an argument > > > to specify descending order on that key, instead of ascending order. It > > > doesn't check its arguments carefully, but if you give it correct > > > arguments, it works :-) > > > Just use comp: (sort-by (multicmp f (comp - g)) coll) > > I don't see how to make that work if the value extracted by function g is > something besides a number, e.g. a string. Do you see a way?
No, you're right. I was thinking you were working with Comparator-type two-arg functions already, in which case this works, but obviously that's not the case. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
