[PD] change list order according to their first element

Mathieu Bouchard matju at artengine.ca
Sun Aug 8 21:02:22 CEST 2010

```On Wed, 28 Jul 2010, Libero Mureddu wrote:

> There are a couple of things though that are not clear to me:

sorry, I believe I forgot to answer some parts of this.

> However, in my case I know only the number of columns (4), but the
> number for the other dimension cannot be fixed in advance (it could be,
> but I'd like it to calculate it with list-length/4 and then generate
> automatically the right grid).  I tried to do [import (\$1 4)] but it
> didn't work. Is there a way to do it?

For strange reasons, the open-parenthesis has to be separated from the
"\$1" so that the "\$1" is replaced by its real value (even with pd version
40, which introduced \$ elsewhere than at the beginning of a symbol). I
don't understand why. Anyway, you just have to insert a space there.

But you can also change it dynamically by sending a list in the right
inlet.

> 2) Actually, I'm using non-integer numbers, but I cannot understand
> how to use them in a grid.

You can only use them in literal forms that also explicitly state the size
of the grid. Thus if you have "2 3 5 7", this can be written more
explicitly as "4 # 2 3 5 7" (which means: a single-dimension grid of four
values, which are 2 3 5 7). Then such a notation is an occasion to say
that you want floats : "4 f # 2 3 5 7".

If you don't state that, GridFlow has to assume that you want ints,
because that's the most traditional type in GridFlow and there is no way
to differentiate number types in Pd itself, so GridFlow had to provide its
own notation and its own choice of a default type.

_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
```