Object to delace lists with patterns different from odd/even ?

Roald Baudoux's icon

Hello,

I want to delace some lists, however I don't want to do it the same way as zl delace.

Example :

With an input list like this one : 1 2 3 4 5 6 7 8 9, I would like to get 1 4 7 on one side and 2 3 5 6 8 9 on the other side.

Of course I could try a combination of counter, zl nth, pack etc but anything simpler would be welcome!

Any idea, Max gurus ?

Thanxinadvance.

Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I would use listfunnel.

Emmanuel Jourdan's icon

btw, this is typical case where textual language might make things easier. Something like that should work in js (forum coding)

outlets = 2;

function list()
{
var a = new Array();
var b = new Array();

for (var i = 0; i < arguments.length; i++) {
if ((i % 3) == 0)
a[a.length] = arguments[i];
else
b[b.length] = arguments[i];
}

if (b.length)
outlet(1, b);
if (a.length)
outlet(0, a);
}

Roald Baudoux's icon

Thanks, Emmanuel.

No magical plain-vanilla Max object to achieve this?

seejayjames's icon

how about [zl iter] --> [zl slice]? tell zl iter the chunk size (like 3), then slice off the first element of each group, the others go out the right outlet.

Or maybe you could generate a list of which elements you want, exactly, and send it to [zl nth]. But that's probably the same as filtering out from the other side.

Roald Baudoux's icon

Thanks James but I meant *one* plain-vanilla object, you know that kind of magical object you have never used and have suddently discovered and you wonder how you could have done without until now...

ch's icon

You can use [zl list.Demultiplex 3] as well

Ch

Roald Baudoux's icon

You meant "mxj list.Demultiplex 3" I suppose. Thanks, I didn't know this one.