[PD] [text define] functionality for text in structs?

Christof Ressi christof.ressi at gmx.at
Tue Mar 28 14:49:04 CEST 2017


> Actually I haven't had a whole lot of issues with traversing data
> structures yet, but that's probably because I haven't dealt with
> gigantic lists of scalars yet.

I have - and traversing large lists of scalars by pointer can be veeeery slow. 

> possible/worthwhile? I suppose maybe the ultimate ideal situation would be to
> be accessible by index, at least from a front-facing user perspective.

you could hide the fact that it's a linked list from the user but I don't know if that's a good thing to do. It doesn't seem transparent to me ("why is accessing the 1000th elements slower than the 1st element?").
 
if you don't use the graphical representation, you can just as well work with data structure arrays and get fast random access. there is one little but unfortunate drawback compared to using lists of scalars: drawn instances of array elements don't respond to mouse events, making them more or less useless as UI elements. if you click/select an element, you only get a pointer to the array, not to the element(s). if you click on the canvas, you get pointers to the array + all array elements (for whatever reason). 
The right behaviour IMHO would be that clicking/selecting array elements gives you pointers to the array *and* the clicked/selected element(s). clicking on the empty canvas shouldn't trigger any mouse events!

Apart from that, data structure arrays are quite easy to handle and much more efficient than linked lists of scalars.

Christof

> Gesendet: Dienstag, 28. März 2017 um 12:48 Uhr
> Von: "Derek Kwan" <derek.x.kwan at gmail.com>
> An: "Miller Puckette" <msp at ucsd.edu>, pd-list at lists.iem.at
> Betreff: Re: [PD] [text define] functionality for text in structs?
>
> Miller Puckette <msp at ucsd.edu> writes:
> 
> > There ought to be a way to do this - some other object than [text define]
> > should be able to do 'read' and 'write' operations.  Perhaps this needs
> > to be added to the [pointer] object somehow.  (For a long time I've wished
> > for a better suite of objects to traverse data structures but can't find
> > a good design :)
> >
> > Miller
> 
> I suppose since we're on the topic, it appears that [array] faces a
> similar situation to [text].
> 
> Actually I haven't had a whole lot of issues with traversing data
> structures yet, but that's probably because I haven't dealt with
> gigantic lists of scalars yet. I made an abstraction to get the nth
> scalar that basically jumps to the head and uses [until] to bang [next(
> until it reaches the desired index, but that method probably becomes
> less-than-ideal as the number of scalars increases. I haven't dug around
> the source for structs much yet, but would perhaps having structs act
> more like doubly-linked-lists rather than singly-linked be
> possible/worthwhile? I suppose maybe the ultimate ideal situation would be to
> be accessible by index, at least from a front-facing user perspective.
> 
> From my perusings of the pd-list archives, I know this definitely has been brought
> up before, but probably one of the more clunkier things about dealing with data
> structures is not being able to delete individual scalars.
> 
> Derek
> 
> -- 
> Derek Kwan
> www.derekxkwan.com
> 
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list