{ "selector" object } { "accum" object }
} ;
-HELP: infimum-by*
+HELP: minimum-by*
{ $values
{ "seq" sequence } { "quot" quotation }
{ "i" integer } { "elt" object }
}
-{ $description "A variant of " { $link infimum-by } " that pushes the index of the least element along with the least element." } ;
+{ $description "A variant of " { $link minimum-by } " that pushes the index of the least element along with the least element." } ;
HELP: insert-nth!
{ $values
}
{ $description "Create a virtual sequence spanning the length covered by " { $snippet "slice1" } " and " { $snippet "slice2" } ". Slices must refer to the same sequence." } ;
-HELP: supremum-by*
+HELP: maximum-by*
{ $values
{ "seq" sequence } { "quot" quotation }
{ "i" integer } { "elt" object }
-} ;
+}
+{ $description "A variant of " { $link maximum-by } " that pushes the index of the greated element along with the greatest element." } ;
HELP: tail*-as
{ $values
{ { 4 0 3 1 2 } } [ { 0 4 1 3 2 } 5 <iota> [ nth* ] curry map ] unit-test
-{ 1 "beef" } [ { "chicken" "beef" "moose" } [ length ] infimum-by* ] unit-test
-{ 0 "chicken" } [ { "chicken" "beef" "moose" } [ length ] supremum-by* ] unit-test
-{ 2 "moose" } [ { "chicken" "beef" "moose" } [ first ] supremum-by* ] unit-test
+{ 1 "beef" } [ { "chicken" "beef" "moose" } [ length ] minimum-by* ] unit-test
+{ 0 "chicken" } [ { "chicken" "beef" "moose" } [ length ] maximum-by* ] unit-test
+{ 2 "moose" } [ { "chicken" "beef" "moose" } [ first ] maximum-by* ] unit-test
{ f } [ f ?supremum ] unit-test
{ f } [ { } ?supremum ] unit-test
{ f } [ { f } ?supremum ] unit-test
PRIVATE>
-: supremum-by* ( ... seq quot: ( ... elt -- ... x ) -- ... i elt )
+: maximum-by* ( ... seq quot: ( ... elt -- ... x ) -- ... i elt )
[ after? ] select-by* ; inline
-: infimum-by* ( ... seq quot: ( ... elt -- ... x ) -- ... i elt )
+: minimum-by* ( ... seq quot: ( ... elt -- ... x ) -- ... i elt )
[ before? ] select-by* ; inline
+ALIAS: supremum-by* maximum-by* deprecated
+ALIAS: infimum-by* minimum-by* deprecated
+
: arg-max ( seq -- n )
- [ ] supremum-by* drop ;
+ [ ] maximum-by* drop ;
: arg-min ( seq -- n )
- [ ] infimum-by* drop ;
+ [ ] minimum-by* drop ;
: ?supremum ( seq/f -- elt/f )
[ f ] [