This is easily done in, for example, Python, and can be very useful. I have spent quite a bit of time searching documentation and reading forum questions, without finding anything.
Here’s a small example of what I would like to do:
arr = [1,2,3,4,-5] sqmax = max(arr, by = x -> x^2)
I know this can be done as follows, but it seems like it would make sense for max() to have a
sqmax = sort(arr, by = x -> x^2)[end]