magnars / dash.el

A modern list library for Emacs
GNU General Public License v3.0
1.66k stars 138 forks source link

Add -min-index and -min-index-by #249

Open Fuco1 opened 6 years ago

Fuco1 commented 6 years ago

This should return the index of the min/max element in the list.

Simple implementation is

(car (-grade-up '< '(3 4 1 0 2))) ;; => minimum is at index 3
(car (-grade-down '< '(3 4 1 0 2))) ;; => maximum is at intex 1
emacksnotes commented 1 year ago

R call these functions which.min and which.max. See https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/which.min

See also Proposal add -which -- Return indices where the list entry is non-nil