Yep, that's what I was looking for. Thanks! -------------------------------------------- On Wed, 1/25/17, Raul Miller <[email protected]> wrote:
Subject: Re: [Jprogramming] Return of max of list and it's index in single pass To: "Programming forum" <[email protected]> Date: Wednesday, January 25, 2017, 12:01 PM maxIndexAndValue=: ((i.,]) >./) I hope this helps, -- Raul On Tue, Jan 24, 2017 at 9:58 PM, 'Jon Hough' via Programming <[email protected]> wrote: > I want to get the max value of a list, and return the first index of its occurrence in the list, tacitly. > > My solution > > maxWithIndex =: {.@:I.@:(= >./), >./ > > works ok, but calculates >./ twice. Is there a tacit way to do this with only a single calc of >./ ? > > Thanks, > Jon > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
