Forums > MaxMSP

unpack Order

December 13, 2008 | 3:30 pm

Does the unpack object unpack the contents of a list in a specific order? IE, right to left? Is it simultaneous? I was just wondering if there is some slight inherent latency in the unpacking? Any ideas?


December 13, 2008 | 3:37 pm

It’s "simultaneous from the right to left".

ej

On 13 déc. 08, at 16:30, Nathan wrote:

>
> Does the unpack object unpack the contents of a list in a specific
> order? IE, right to left? Is it simultaneous? I was just wondering
> if there is some slight inherent latency in the unpacking? Any ideas?


December 13, 2008 | 4:42 pm

AFAIK nothing in the computer world is truly simultaneous unless you have parallel processing or multiple CPUs. Most processing happens linearly, just super-fast. The unpack object, as well as pretty much all other objects, outputs right-to-left. Attach a [print] object to each outlet (with a different name for each) and you’ll see the order in the Max window.

Also look into [trigger] which allows you to specify the order of your operations, which can be indispensable in certain situations. If you attach multiple [print] objects to the same outlet in the unpack example, they will come out based upon where the [print] objects are in the patch: right to left, then top to bottom. This can be a little weird at first, so if you want to specify order without worrying about where your objects have to be, use [trigger].


December 13, 2008 | 5:18 pm

No. Right to left, bottom to top.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 26 197 41 196617 print 4;
#P newex 82 171 41 196617 print 3;
#P newex 82 236 41 196617 print 2;
#P newex 132 197 41 196617 print 1;
#P newex 97 119 72 196617 unpack a b c d;
#P button 97 98 15 0;
#P newex 302 162 41 196617 print 4;
#P newex 358 136 41 196617 print 3;
#P newex 358 201 41 196617 print 2;
#P newex 408 162 41 196617 print 1;
#P message 373 84 26 196617 666;
#P connect 6 0 10 0;
#P connect 6 0 9 0;
#P connect 6 0 8 0;
#P connect 6 0 7 0;
#P connect 5 0 6 0;
#P connect 0 0 4 0;
#P connect 0 0 3 0;
#P connect 0 0 2 0;
#P connect 0 0 1 0;
#P window clipboard copycount 11;


December 13, 2008 | 5:29 pm

There are a slew of ways to form and reorder lists. When unpacking, one of the easiest ways to ensure you’ll get elements outputing in the desired order is to first pass the list throug a zl object.

best,
Zachary

max v2;
#N vpatcher 10 59 323 358;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 36 53 43 196617 1 2 3 4;
#P newex 86 222 50 196617 print 4th;
#P newex 108 197 51 196617 print 3rd;
#P newex 130 172 51 196617 print 2nd;
#P newex 193 78 37 196617 zl rev;
#P message 193 53 43 196617 1 2 3 4;
#P newex 142 78 44 196617 zl rot 1;
#P message 142 53 43 196617 1 2 3 4;
#P newex 86 112 76 196617 unpack 0 0 0 0;
#P newex 86 77 49 196617 zl rot -1;
#P message 86 53 43 196617 1 2 3 4;
#P newex 152 147 50 196617 print 1st;
#P connect 1 0 2 0;
#P connect 11 0 3 0;
#P connect 2 0 3 0;
#P fasten 5 0 3 0 147 103 91 103;
#P fasten 7 0 3 0 198 103 91 103;
#P connect 3 0 10 0;
#P connect 3 1 9 0;
#P connect 3 2 8 0;
#P connect 4 0 5 0;
#P connect 3 3 0 0;
#P connect 6 0 7 0;
#P pop;


December 14, 2008 | 3:03 am

yes, bottom to top. oops.


Viewing 6 posts - 1 through 6 (of 6 total)