Re: [PD] List delete carnage - 2 questions

2011-03-31 Thread Mathieu Bouchard

On Tue, 29 Mar 2011, Frank Barknecht wrote:


Your list-drip.pd was included in [list]-abs at about that time. Message boxes
are used in a handful of objects to speed things up, but probably some more
places would be useful. I don't remember ATM if message box storage works fine
with pointers as well, but there are objects where only floats would be allowed
anyway.


consistency check failed: bad item in binbuf

while trying to output a gem pointer from a messagebox. not a real pd 
pointer though. note that it does not complain while putting the pointer 
in the binbuf using 'set' or 'add2', only when trying to output it.


i'll let you make the test using true pd pointers because I never remember 
how to use them, not to mention why t_gpointer and t_gstub have to exist 
at all.


 ___
| Mathieu Bouchard  tél: +1.514.383.3801  Villeray, Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-29 Thread Mathieu Bouchard

On Sun, 27 Mar 2011, Matt Barber wrote:


number to the end of the last list -- but we need to store the last
list as the thing to prepend, so it has to go back into the right
inlet, and the only good way of doing that is [t a] (you could just
use a [list] object, too, but [t a] seems more reliable and what
people use most).


I don't see what you mean about reliability. I only know that going 
through a [list append] is taking O(n) time, while going through a [t a] 
takes O(1) time.


Also, adding n elements to a list individually using [list]x[list] takes 
O(n^2) time, with [list]x[t a] it takes O(n^2) time too, and using a 
messagebox's add-method you can lower it to O(n). It's faster if you hide 
the messagebox in a subpatch.


From what I remember, the list-abs library does not use messageboxes, only 
[list]x[t a], and thus several things are still O(n^2) even though they 
could be O(n), and even though I upgraded [list-drip] from O(n^2) to O(n) 
two years ago.


 ___
| Mathieu Bouchard  tél: +1.514.383.3801  Villeray, Montréal, QC
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-29 Thread Frank Barknecht
On Tue, Mar 29, 2011 at 09:27:03AM -0400, Mathieu Bouchard wrote:
 On Sun, 27 Mar 2011, Matt Barber wrote:

 number to the end of the last list -- but we need to store the last
 list as the thing to prepend, so it has to go back into the right
 inlet, and the only good way of doing that is [t a] (you could just
 use a [list] object, too, but [t a] seems more reliable and what
 people use most).

 I don't see what you mean about reliability. I only know that going  
 through a [list append] is taking O(n) time, while going through a [t a]  
 takes O(1) time.

 Also, adding n elements to a list individually using [list]x[list] takes  
 O(n^2) time, with [list]x[t a] it takes O(n^2) time too, and using a  
 messagebox's add-method you can lower it to O(n). It's faster if you hide 
 the messagebox in a subpatch.

 From what I remember, the list-abs library does not use messageboxes, 
 only [list]x[t a], and thus several things are still O(n^2) even though 
 they could be O(n), and even though I upgraded [list-drip] from O(n^2) to 
 O(n) two years ago.

Your list-drip.pd was included in [list]-abs at about that time. Message boxes
are used in a handful of objects to speed things up, but probably some more
places would be useful. I don't remember ATM if message box storage works fine
with pointers as well, but there are objects where only floats would be allowed
anyway. 

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-27 Thread J bz
Hey Charlot,


Yes, that seems a good approach.

Will try in a few hours with a bit more time.

You did not sew it solid enough it seems:).

Definitely dropped a few stitches with this one:)  I try to re-attach.

(btw - what is up with gmail and attachments atm?)


All good wishes,

Julian

On 27 March 2011 02:07, Charles Goyard c...@fsck.fr wrote:

 J bz wrote:
 
  I have a sensor which is spitting out numbers between 1-180.
 
  Each number triggers an event that I only want to happen once but the
 sensor
  repeats numbers every so often.

 You can use a table of 180 elements, each of which is initialized with
 zeros. When a sensor number occurs, check against the table. If it's 0,
 turn it to 1 and go on. If it's 1, do nothing and wait for a fresh
 number from the sensor. Or, if you don't want to wait, scan the
 table for the first zero. What appends when there's no zeros left is up
 to you.

  (patch attached)

 You did not sew it solid enough it seems:).

 --
 Charlot

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list



list-delete_carnage.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-27 Thread J bz
Hey Matt,

Whoo-Hoo.  That's splendid.

Can I ask you what the [t a] is doing that's looping with the [list
prepend]?  Just for my own understanding.

Bloody marvellous though.

All good wishes,

Julian



On 27 March 2011 16:19, Matt Barber brbrof...@gmail.com wrote:

 Here's another approach using only list abs stuff (sorry for the messy
 -- I threw it together quickly). Could use as an abstraction with two
 inlets -- one on the right which receives a bang to initialize and one
 on the left that takes incoming numbers from the sensor, and one
 outlet (the outgoing numbers).

 Matt



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-27 Thread Matt Barber
Sure,

PD doesn't give you a way to connect an outlet to an inlet of the same
object, which is what's needed here to populate the first list with
the numbers from 1-180 (it's one way to do it anyway). In this case,
I'm using a counter to count up to 180, and on each bang from the
[until] the new number goes into the [list prepend], which adds the
number to the end of the last list -- but we need to store the last
list as the thing to prepend, so it has to go back into the right
inlet, and the only good way of doing that is [t a] (you could just
use a [list] object, too, but [t a] seems more reliable and what
people use most).

There are probably plenty of other ways of doing the same thing.

Matt

On Sun, Mar 27, 2011 at 6:12 PM, J bz jbee...@gmail.com wrote:
 Hey Matt,

 Whoo-Hoo.  That's splendid.

 Can I ask you what the [t a] is doing that's looping with the [list
 prepend]?  Just for my own understanding.

 Bloody marvellous though.

 All good wishes,

 Julian



 On 27 March 2011 16:19, Matt Barber brbrof...@gmail.com wrote:

 Here's another approach using only list abs stuff (sorry for the messy
 -- I threw it together quickly). Could use as an abstraction with two
 inlets -- one on the right which receives a bang to initialize and one
 on the left that takes incoming numbers from the sensor, and one
 outlet (the outgoing numbers).

 Matt




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] List delete carnage - 2 questions

2011-03-26 Thread J bz
Hey all,

I'm stuck.

I have a sensor which is spitting out numbers between 1-180.

Each number triggers an event that I only want to happen once but the sensor
repeats numbers every so often.

What I require is to have my numbers in 'something', so that if that number
has already been used I want Pd to say - 'hey' and then allow me to change
that number until we find one that hasn't been used?

I have spent the last couple of hours working with my numbers in a message
box and using [list-delete].  I think it must be my usage because it's
behaving very erratically (patch attached).  If someone could tell me what
I'm doing wrong with this and then maybe I/we can get onto the main problem
- which is; what should/can I use that will tell me if a number has already
been used and spit it back at me so I can do some maths stuff to change to a
different number that hasn't been used already.

Best wishes,

Julian

W7 PDE (latest)
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] List delete carnage - 2 questions

2011-03-26 Thread Charles Goyard
J bz wrote:
 
 I have a sensor which is spitting out numbers between 1-180.
 
 Each number triggers an event that I only want to happen once but the sensor
 repeats numbers every so often.

You can use a table of 180 elements, each of which is initialized with
zeros. When a sensor number occurs, check against the table. If it's 0,
turn it to 1 and go on. If it's 1, do nothing and wait for a fresh
number from the sensor. Or, if you don't want to wait, scan the
table for the first zero. What appends when there's no zeros left is up
to you.

 (patch attached)

You did not sew it solid enough it seems:).

-- 
Charlot

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list