list operation - last of first to first of last

jamesson's icon

I have a 32-item list that I need to output in sets of 4. The first set should be the first 4 items. The second set should be the first 4 after the first 2, ie the last 2 of the first 4 and the first 2 of the next 4, and so on til the end of the list. In other words

1234
3456
5678

etc

Thanks much in advance

Joe

jonathanb's icon

Check out the zl object. It will be your friend.

jamesson's icon

I know ZL pretty well, but well enough to see how to do this with efficiency.

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

like that? then it is a very simple thing just using two [zl slice] objects.

jamesson's icon

Yes my backrouting is really not what it should be. I must study more.

xidance's icon

[zl] is pretty much worth the investment. slice, group, lace, rotate... such lovely playground for collected data manipulation.

jamesson's icon

Its not so much the zl, like I said, its the backrouting.

Wetterberg's icon

@xidance that is some spiffy patching right there!

:hats off:

Wetterberg's icon

this is what I cobbled together from this.

It'll take an x-node breakpoint function on the Lemur, swizzle the x/y pairs together, scale it to the display size and output it in the linesegment format as described.

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

Now on to what I'd like to do with this approach: draw onto jit.gl.sketch!

jamesson's icon

any way to do this without the Giant Output Handler of Death?

Thanks

Joe

Wetterberg's icon

What do you mean? Or, are you being deliberately cryptic?
Do you mean jamoma? if so, plenty of ways, you can do this with plain route almost as easily.
do you mean the Lemur? If so, not so many ways, I guess. touchosc on android outputs similarly long and tedious lists.
do you mean the "t b l clear"? No.

jamesson's icon

I mean, the output patcher in the original post. I need to put it into an lcd as linesegment, and I couldn't get your thing to work properly. The output did not match the input.

Wetterberg's icon

Did you ever tell us what you're building? Which original post are you referring to - I'd like to read up on it.
I've seen little bits spread out over multiple threads, so I don't really know what your output handler... is, exactly.

That little thing I just posted is literally all you would need to turn a list of x's and a list of y's into a line like that.
http://dl.dropbox.com/u/12606333/lemur_bp.JPG

jamesson's icon

I'm doing a kinect input handler. This subsection is for gesture processing. It does 3 things

1)"downsampling" via speedlim
2) creating a list of xy coord pairs via zl group
3) displaying the list on lcd via linesegment

To do 3, you need lists of 4 values as I described.

Roman Thilenius's icon

zl ecil 2
and then both, the ecil output and the original into
zl iter 4

jamesson's icon

Roman - very sorry, tried a few times, no good - coultd you post pls?

Wetterberg's icon

>3) displaying the list on lcd via linesegment

>To do 3, you need lists of 4 values as I described.

yes, and that's why there's the zl slice 4 and zl slice 2 in the patch I posted - this makes those segments, which is why the "linesegment" command works.

If you take your lists of x coords and feed them into the leftmost inlet of "zl lace", your y's and feed them into the right-most you should, provided your values are scaled right, get the same results that I am getting.

Zl lace is doing the shuffling, and the zl slice is iterating through those groups until there aren't any left.

jamesson's icon

Perfect

Thanks so much

Joe