[PD] [#store] grid index

Mathieu Bouchard matju at artengine.ca
Thu Jun 24 18:01:49 CEST 2010


On Thu, 24 Jun 2010, patko wrote:

> It's about sorting a bunch of lists according to what's the first element of each list.

Ok, I just made you a patch for it.

The trick is to use a [#slice] to extract the information to sort about ; 
however the [#slice] needs to know the height of the grid, so you need a 
[#dim]. the [#unpack] and msgbox is only one way to do it in two steps : 
you can also do [# * (1 0)] [# + (0 1)] and there are a bunch of other 
equivalent ways.

Then, when you have a grid of size (n 1) and you need to get it to size 
(n), you'd do something like [#fold +] or [#fold put], and to undo it back 
to size (n 1), you'd do something like [#outer + (0)] or [#outer ignore 
(0)]. Note that the parens are essential in the latter case, unlike a typo 
I removed yesterday.

It's national holiday today (basically, same as your july 14th), and our 
law says that any work done on that day has to be paid triple rate. So I'm 
gonna charge you 3 times the amount I usually charge you. ;)

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
-------------- next part --------------
#N canvas 536 202 450 300 10;
#X obj 39 199 #store;
#X obj 39 218 display;
#X msg 39 30 4 5 # 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 4 5 6 7 8;
#X obj 39 49 t a a;
#X obj 144 66 #dim;
#X obj 144 85 #unpack;
#X msg 144 104 \$1 1;
#X obj 39 123 #slice (0 0) (0 0);
#X obj 39 142 #fold +;
#X obj 39 161 #grade;
#X obj 39 180 #outer ignore (0);
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 3 0 7 0;
#X connect 3 1 4 0;
#X connect 3 1 0 1;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 7 2;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 0 0;


More information about the Pd-list mailing list