get the range from a number in a list

    Feb 04 2011 | 1:17 pm
    maybe a dummy question, sorry for the hassle. So I have a list of, say 4 numbers : 2 4 9 11 and when I get the number - say 4 - from another part of the patch, I'm looking for a way to test this number in the list below and output it's range, in fact here 2.
    I can't figure it out with zl, as zl nth gives me the value of the nth element of the list, and I need its range.
    Thanks for your help.

    • Feb 04 2011 | 1:40 pm
      I am not sure if I understand what you mean by "range" - do you mean the position of the item on the list? An easy solution is this:
      However, this only works if you DON'T have repeating numbers in your initial list of numbers. Can't think of anything else (i don't really work with lists much), so maybe someone more knowledgeable on [zl] or other list-manipulation objects can help you out more (I'm curious as to the answer too)
    • Feb 04 2011 | 1:43 pm
      thanks - a more dummy one : how to save your text as a maxpatch (on a mac) ? thanks.
    • Feb 04 2011 | 2:03 pm
      Copy the whole kaboodle in your clipboard (so from ---begin to ---end, including those lines.
      Then in the Max window choose either File -> New from clipboard or press its key function (on Windows control-alt-N, dunno on Mac).
    • Feb 04 2011 | 2:05 pm
      Thanks, the patch works for me