... what about 'select' or 'select-by'? (If not... I'm just helping eliminate all the bad names... =)
On Mon, Oct 12, 2015 at 7:39 PM Alex Knauth <alexan...@knauth.org> wrote: > The names `first-by` and `find-first-by` both sound good to me. > > Alexis? > > On Oct 12, 2015, at 4:54 PM, Martin DeMello <martindeme...@gmail.com> > wrote: > > One problem with generalising find-max and find-min into a single hof is > that they are closer in spirit to a fold than a find. The name find- makes > you think that the passed in function should be a predicate on one element, > not two. How about something like first-by? > > > (first-by string<? (compose1 symbol->string second) '((3 pears) (1 > banana) (2 apples))) > '(2 apples) > > martin > > On Sun, Oct 11, 2015 at 3:24 PM, Alex Knauth <alexan...@knauth.org> wrote: > >> Hi, >> >> Alexis King and I were discussing adding versions of argmin and argmax to >> the alexis/collection library, but we agreed that find-min and find-max >> were clearer names. Then we came up with a generalization of those that >> would take an ordering procedure (< for find-min and > for find-max), and >> find the element that had a property greater/less than the properties of >> all the other elements, by the ordering procedure (not restricted to >> numbers). >> >> The problem was naming it. We thought of `find-best` and >> `find-most-relevant`, but `find-best` would be confusing when it's being >> used to find the worst case, and `find-most-relevant` seems better but to >> wordy. >> >> Do any of you have any ideas? >> >> Examples: >> > (the-function < first '((3 pears) (1 banana) (2 apples))) ; find-min >> would be a shorthand for this >> '(1 banana) >> > (the-function > first '((3 pears) (1 banana) (2 apples))) ; find-max >> would be a shorthand for this >> '(3 pears) >> > (the-function string<? (compose1 symbol->string second) '((3 pears) (1 >> banana) (2 apples))) >> '(2 apples) >> > (the-function string>? (compose1 symbol->string second) '((3 pears) (1 >> > banana) >> (2 apples))) >> '(3 pears) >> >> *https://github.com/lexi-lambda/racket-alexis-collections/pull/9#issuecomment-145727937 >> <https://github.com/lexi-lambda/racket-alexis-collections/pull/9#issuecomment-145727937>* >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket-users+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.