hi Krzyzstof,
more of that brainfood, please! It's really permutaining. Apart from being an interesting approach, it taught me a lot of things about pd (and its differences to MAX), I didn't know. There should be more examples out there which show different programming styles.
About being generic: If the english meaning of "permutation" is the same as the german, permutation means a mapping of positions as implemented in my previous patch. What you proposed we call "combination": It refers to all possible combinations of a certain set of numbers (maybe even with a given subset, like in lotteries, where you select 6 numbers out of 49). There are lots of interesting properties of permutations, regarding their periods etc. which make them a somehow special subset of all possible combinations and that's probably the reason, why especially composers in the 50s really liked them (otherwise the pieces would have gotten even longer...).
Among the externals, I wrote for Max was also a patch, which does all combinations (of sets and of subsets of sets). This external has the advantage of being indexable and of telling you the exact number of possible combinations. I don't remember the exact approach about the systematics anymore, but I know, I had to make it up myself, too. I remember not being too satisfied with it. I'll send the original C-code to you in a seperate email together with the code for the permutation external. That way you can find out, how it was done.
Anybody else interested in it should let me know.
-- Orm
P.S.: I have to admit that I prefer a text based approach to solving problems like this, as I find it more comprehensible to read
for (i=max;((i > 0)&&(!found-first)); i--) ...
than to clutter the patch with int and +1 and trigger and until boxes just in order to implement a simple loop. That's probably, why I made code externals and after a while switched to James Mc'Cartneys "pyrite" object for Max (some sort of programming language with embedded text editor in a max object) before more or less ending the Max business altogether some 6 years ago. But that's probably poison for a pd-list =:-)
Am Donnerstag, den 24. Januar 2002 um 21:01:29 Uhr (+0100) schrieb Krzysztof Czaja:
hi,
since Orm's [pd permute] cycles with a period of 6 (out of 5! == 120), I have just patched a correct(?) one as an evening refresher, trying to make it a bit more generic too...
This one is clumsy! But is there much simpler way?
Or is this yet another case of my blindness?
Krzysztof