creating a list from 0 to N without [counter]

Jason Charney's icon

In the current project I'm working on I've several instances in which I need to create a list n numbers long that's comprised of integers from 0...(n-1).

For example, I want to be able to send in integer 7 and get the list [0 1 2 3 4 5 6].

Can't figure out a way to do this that doesn't involve [uzi] or [counter]...I really dislike all the reset logic I have to use with those solutions. Any ideas?

metamax's icon

How about this?

(just made a quick edit so it starts from zero)

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

Jason Charney's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Wonderful - thanks so much. Just added this lil abstraction to my library - hadn't thought to use [zl.group].

metamax's icon

Yeah, that's a nice one. Even better, there is really no need for the [t i set] in the abstraction.. unless you really need the message box cleared, but then you'd need a second outlet.

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