What about "find-min-by"/"find-max-by"?  (Or, if it's more standard Rackety style, "find-min/by" and "find-max/by", where the slash denotes a variant of an otherwise common function...)

Ben

On 10/11/2015 6:24 PM, Alex Knauth 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)


--
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.

Reply via email to