Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
cyclone/coll can sort the messages you store in it.
-Jonathan
----- Original Message -----
From: Andy Farnell padawan12@obiwannabe.co.uk To: Benoît Fortier benoitfortier@yahoo.ca Cc: pd-list pd-list@iem.at Sent: Wednesday, March 14, 2012 6:17 PM Subject: Re: [PD] store and manipulate multiple lists
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific
order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite
entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thanks, that looks like what I need!
Benoît
De : Jonathan Wilkes jancsika@yahoo.com À : Andy Farnell padawan12@obiwannabe.co.uk; Benoît Fortier benoitfortier@yahoo.ca Cc : pd-list pd-list@iem.at Envoyé le : mercredi 14 mars 2012 18h25 Objet : Re: [PD] store and manipulate multiple lists
cyclone/coll can sort the messages you store in it.
-Jonathan
----- Original Message -----
From: Andy Farnell padawan12@obiwannabe.co.uk To: Benoît Fortier benoitfortier@yahoo.ca Cc: pd-list pd-list@iem.at Sent: Wednesday, March 14, 2012 6:17 PM Subject: Re: [PD] store and manipulate multiple lists
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific
order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite
entertaining!
Benoît
_______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thanks Andy. But as far as I know, [list-sort] will sort the number in a list, and what I really need is to sort multiple lists according to their first element (which are numbers)... is there a trick with [list-sort] that allows to do that?
Benoît
De : Andy Farnell padawan12@obiwannabe.co.uk À : Benoît Fortier benoitfortier@yahoo.ca Cc : pd-list pd-list@iem.at Envoyé le : mercredi 14 mars 2012 18h17 Objet : Re: [PD] store and manipulate multiple lists
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 2012-03-14 à 15:26:00, Benoît Fortier a écrit :
Thanks Andy. But as far as I know, [list-sort] will sort the number in a list, and what I really need is to sort multiple lists according to their first element (which are numbers)... is there a trick with [list-sort] that allows to do that?
No.
What does the job is http://gridflow.ca/help/%23grade-help.html
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
Yes of course. Once you can sort items of any type you can sort aggregate items, structs, sublists or whatever on one of their elements. Its a little messy in Pd. The best way might be to use pointers and try to do the classic Kernighan and Richie head swap thing but I have no idea how to exchange pointers in Pd.
This attached thing should do the job and be adaptable to variable record lengths. You might be able to hack it to work with symbols as well as floats.
It totally fails if the keys are not ubique though :(
a.
On Wed, Mar 14, 2012 at 03:26:14PM -0700, Benoît Fortier wrote:
Thanks Andy. But as far as I know, [list-sort] will sort the number in a list, and what I really need is to sort multiple lists according to their first element (which are numbers)... is there a trick with [list-sort] that allows to do that?
Benoît
De : Andy Farnell padawan12@obiwannabe.co.uk à: Benoît Fortier benoitfortier@yahoo.ca Cc : pd-list pd-list@iem.at Envoyé le : mercredi 14 mars 2012 18h17 Objet : Re: [PD] store and manipulate multiple lists
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi,
On Thu, Mar 15, 2012 at 11:39:51AM +0000, Andy Farnell wrote:
Yes of course. Once you can sort items of any type you can sort aggregate items, structs, sublists or whatever on one of their elements. Its a little messy in Pd. The best way might be to use pointers and try to do the classic Kernighan and Richie head swap thing but I have no idea how to exchange pointers in Pd.
Sorting lists of numbers by their first element is pretty easy to do with Pd's data structures/pointers. I don't have Pd at hand now to patch an example (maybe Monday), but basically you first define a data structure with one "float x" field and one with an array of these float-items in addition to its own float x.
[pd $0-f]: structure with one float item: [struct $0-f float x]
[pd $0-record]: structure with an x-float for sorting and the array "data" to hold all the list items: [struct $0-record float x array data $0-f]
Then you create the structured data from the lists and write them to a subpatch as usual with data structures. The first element in an incoming lists doubles as "x" position, the array holds the rest of the list.
[r one-list]
|
[t a a a]
| | |
| | [list split 1]
| | | ... traverse subpatch blabla
| | [append $0-record x]
| | |
| | [s $0-current-pointer]
| |
| [list length] [r $0-current-pointer]
| | |
| [setsize $0-record data]
|
[list-enumerate] <- list-drip with index numbers, i.e. "list a b" -> "0 a, 1 b"
|
[swap] [r $0-current-pointer]
| \ |
[element $0-record data]
|
[set $0-f x]
Then sorting is just a message "sort" to the subpatch receiver, afterwards dump the lists again using basically the opposite from above. You're only interested in the "data" array now.
Frank
I'm still not familiar with data structure and pointers in pd, but I think I'll use your suggestion as a starting point. Thanks! BEnoît
De : Frank Barknecht fbar@footils.org À : pd-list@iem.at Envoyé le : samedi 17 mars 2012 11h49 Objet : Re: [PD] Re : store and manipulate multiple lists
Hi,
On Thu, Mar 15, 2012 at 11:39:51AM +0000, Andy Farnell wrote:
Yes of course. Once you can sort items of any type you can sort aggregate items, structs, sublists or whatever on one of their elements. Its a little messy in Pd. The best way might be to use pointers and try to do the classic Kernighan and Richie head swap thing but I have no idea how to exchange pointers in Pd.
Sorting lists of numbers by their first element is pretty easy to do with Pd's data structures/pointers. I don't have Pd at hand now to patch an example (maybe Monday), but basically you first define a data structure with one "float x" field and one with an array of these float-items in addition to its own float x.
[pd $0-f]: structure with one float item: [struct $0-f float x]
[pd $0-record]: structure with an x-float for sorting and the array "data" to hold all the list items: [struct $0-record float x array data $0-f]
Then you create the structured data from the lists and write them to a subpatch as usual with data structures. The first element in an incoming lists doubles as "x" position, the array holds the rest of the list.
[r one-list]
|
[t a a a]
| | |
| | [list split 1]
| | | ... traverse subpatch blabla
| | [append $0-record x]
| | |
| | [s $0-current-pointer]
| |
| [list length] [r $0-current-pointer]
| | |
| [setsize $0-record data]
|
[list-enumerate] <- list-drip with index numbers, i.e. "list a b" -> "0 a, 1 b"
|
[swap] [r $0-current-pointer]
| \ |
[element $0-record data]
|
[set $0-f x]
Then sorting is just a message "sort" to the subpatch receiver, afterwards dump the lists again using basically the opposite from above. You're only interested in the "data" array now.
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi Benoît,
On Sat, Mar 17, 2012 at 01:26:35PM -0700, Benoît Fortier wrote:
I'm still not familiar with data structure and pointers in pd, but I think I'll use your suggestion as a starting point. Thanks!
Learning data structures is a bit confusing at first, but many typical operations repeat again and again in almost the same way. It's like the [f ]x[+ 1] counter: At first it's hard to understand, but later you'll just do it without thinking.
Attached is a working sort patch.
Frank Barknecht Do You RjDj.me? _ ______footils.org__
try the matrix object from the iemmatrix lib, you can input each list to a row or column and then you can sort a row or column or even the whole matrix
On Wed, Mar 14, 2012 at 7:26 PM, Benoît Fortier benoitfortier@yahoo.cawrote:
Thanks Andy. But as far as I know, [list-sort] will sort the number in a list, and what I really need is to sort multiple lists according to their first element (which are numbers)... is there a trick with [list-sort] that allows to do that?
Benoît
*De :* Andy Farnell padawan12@obiwannabe.co.uk *À :* Benoît Fortier benoitfortier@yahoo.ca *Cc :* pd-list pd-list@iem.at *Envoyé le :* mercredi 14 mars 2012 18h17 *Objet :* Re: [PD] store and manipulate multiple lists
[list sort]
maybe?
a.
On Wed, Mar 14, 2012 at 03:04:25PM -0700, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific
order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
Thank you all, this list has been very helpfull to me, and its also
quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 14/03/12 23:04, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
For me it is not very clear if:
a. your patch outputs some unordered lists for which you want to save the produced order E.g. [x y z( [z x y( [a b c(
should be written to the text file in that order 1 x y z; 2 z x y; 3 a b c;
or
b. your patch outputs lists like [3 x y z( [1 z x y( [2 a b c( in an unknown order and you want to save them in the text file as: 1 z x y; 2 a b c; 3 x y z;
In case a. it's quite trivial just add a counter which grows at each list production and prepend it to the list then add the list to the [textfile] In case b. I would probably save the lists unordered with [textfile] and then use some scripting like python to easily sort them
Lorenzo.
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
My problem is similar to your case b. Maybe I shoud mention at this point that the lists are midi messages, and the first number of each lists are timestamps.
I'm looking for a solution within pd. I shall have a look at all your suggestions, they look all very good. The [coll] object seems to be the easiest solution to adapt to my patch, but I don't like the fact that the [sort< fonction strips out the number it uses to do sorting, in my case the timestamp which is off course an important information. But well, thats quite easy to fix.
For your interest, the goal of the patch is to create a text file which will be converted into a midi file using [seq]. It seems that [seq] works well only with sequentially ordered midi messages.
Thanks again Benoît
De : Lorenzo Sutton lorenzofsutton@gmail.com À : pd-list@iem.at Envoyé le : jeudi 15 mars 2012 8h41 Objet : Re: [PD] store and man
On 14/03/12 23:04, Benoît Fortier wrote:
Hi everybody,
I need to store multiple lists of numbers in a text file in a specific order : the first number of each list must be ascending, from the first line of the text file to the last. The problem is this : my patch outputs the lists in an unordered way. I could rewrite the patch so that the lists gets outputed the correct way, but to be able to store all the lists somehow and then write a patch to order them afterward feels to me like a much more elegant solution. Any toughts on this?
For me it is not very clear if:
a. your patch outputs some unordered lists for which you want to save the produced order E.g. [x y z( [z x y( [a b c(
should be written to the text file in that order 1 x y z; 2 z x y; 3 a b c;
or
b. your patch outputs lists like [3 x y z( [1 z x y( [2 a b c( in an unknown order and you want to save them in the text file as: 1 z x y; 2 a b c; 3 x y z;
In case a. it's quite trivial just add a counter which grows at each list production and prepend it to the list then add the list to the [textfile] In case b. I would probably save the lists unordered with [textfile] and then use some scripting like python to easily sort them
Lorenzo.
Thank you all, this list has been very helpfull to me, and its also quite entertaining!
Benoît
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 15/03/12 14:57, Benoît Fortier wrote:
My problem is similar to your case b. Maybe I shoud mention at this point that the lists are midi messages, and the first number of each lists are timestamps.
Did you have a look at qlist?
I'm looking for a solution within pd. I shall have a look at all your suggestions, they look all very good. The [coll] object seems to be the easiest solution to adapt to my patch, but I don't like the fact that the [sort< fonction strips out the number it uses to do sorting, in my case the timestamp which is off course an important information. But well, thats quite easy to fix.
For your interest, the goal of the patch is to create a text file which will be converted into a midi file using [seq]. It seems that [seq] works well only with sequentially ordered midi messages.
Not sure on what operating system you are... but if you are on linux you might explore connecting Pd to a sequencer. But of course in this case the 'all within Pd' parameter falls.
Lorenzo.