[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] maxIndex and minIndex?



OK, finally found time to sort this, committed in the form requested, with Help file updates as well.

best,
N

Array.interpolation(10,3.2,5.9).maxIndex({|elem| (10-elem)+rrand(1,3)})

On 27 Dec 2007, at 17:52, Josh Parmenter wrote:

Sure... good point. Perhaps there should be a function that can also be passed in to line up with maxItem and minItem's methods? What is here should be used for a true evaluation of function.isNil.if() .

Josh

On Dec 27, 2007, at 8:47 AM, James Harkins wrote:

It works but it's inefficient, because it could require as many as
a.size*2 iterations if the max or min item is last in the array (where
Click's version maxes out at a.size iterations).
hjh

On Dec 27, 2007 11:39 AM, Josh Parmenter <josh@xxxxxxxxxxxxxxxxx> wrote:
would something like this work?

a  = [0, 3, 2, 5, 8, 3, 9, 6, 5]

a.indexOf(a.maxItem)
a.indexOf(a.minItem)


--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/


_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel