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

Re: [sc-users] detect / detectIndex





On May 3, 2004, at 3:01 PM, Julian Rohrhuber wrote:


well to ask the other way round: you want to know the next item from a certain index on that has a certain property. For example say you have a collection of synths that you want to insert a new synth in. Now you don't know which of these are actually playing, so you want to find the next one playing to add your new synth before that one. How would you do that without duplicating the whole method code I posted?


Why aren't you keeping a list of playing ones? Could you use a Routine that wraps detect?
And anyway you can do this:

myCollection[offset..].detect {|item| ..blah.. };