Comparing to a list

benb7760's icon

I am trying to find the best way to take a list (varying length) of values which increment upward, and compare them to another value. The result of this should return the two values which it was between (more preferably I'd like it to return the index at which it was found)

ie comparing 5024 to this list:

(assuming the first element is defined as element 1)

0 2423 4865 6057

should output 3 and 4

Cheers, Ben

ch's icon

Hi,

There's many way.

Something like that could do the trick :

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

one way would be to append it to the list, sort the list again,
and then finding its position by comparing with itself using
[zl iter 1], [counter], [==] ...