<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div>Datastructure behaves exactly like C language, if all variables and functions are already writen on a paper or with merise or UML, like it would usually be done with a c or c++ program, variable naming and memory allocation becomes easier. In C this is exactly the same method for accessing a place in memory, traversing a template, from pointer to another, if you want to access directly a particular place in memory, use arrays instead. It's possible to change scalars with textfile like I suggested in my first message in this topic.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><div style="font-size:100%">Patrice Colet&nbsp;</div></div> <br><br><br>-------- Message d'origine --------<br>De : Roman Haefeli &lt;reduzent@gmail.com&gt; <br>Date : 28/05/2013  9:57  (GMT+00:00) <br>A : pd-list &lt;pd-list@iem.at&gt; <br>Objet : Re: [PD] first exercise with data structures <br> <br><br>Thanks for sharing your mind on the topic.<br><br>Probably this has already been covered as a limitation and may I haven't<br>really understood it. There is one thing troubling me at the moment.<br>From what I can see, you can easily get data out of your data structure.<br>And for what I am trying, editing data manually/per GUI is quite easy.<br>But how to set data programmatically, i.e. by message? As you can only<br>change a certain scalar by setting a pointer to it, the only way I see<br>is to traverse all scalars until you find the one you want to change. Is<br>this currently the only way to change a property of a particular scalar?<br><br>Roman<br><br><br>On Sam, 2013-05-25 at 12:13 +0200, João Pais wrote:<br>&gt; jonathan already gave a smart reply to your question, using variable&nbsp; <br>&gt; variables as delimiters in your polygons, you can vary everything. If you&nbsp; <br>&gt; notice, in your first example you could vary the position of the&nbsp; <br>&gt; individual array elements (because you don't have a fixed x distance), but&nbsp; <br>&gt; you couldn't vary the position of the whole array - which wasn't necessary&nbsp; <br>&gt; for now, but I just wanted to remark that.<br>&gt; <br>&gt; I would add only something to your [setsize bar_struct bar_array]&nbsp; <br>&gt; construct: in case you want to get a pointer of a specific template, use&nbsp; <br>&gt; the template's name as argument e.g. [pointer bar_struct], and route the&nbsp; <br>&gt; exit of the 2nd outlet to a [next(. That creates a loop that only stops&nbsp; <br>&gt; when you get your pointer. if you have several scalars of the same&nbsp; <br>&gt; template, adding a [get ...] to that loop makes it better (in case you&nbsp; <br>&gt; have a sort of identifier for each scalar).<br>&gt; <br>&gt; A not-so-efficient-as-Jonathan's example of dynamic polygons can be seen&nbsp; <br>&gt; in my [jmmmp/bezier] abstraction (attached also the upcoming audio&nbsp; <br>&gt; version). Inside my folder are a couple other abstractions using data&nbsp; <br>&gt; structures (some new ones might appear only in the next pd-ext release).<br>&gt; <br>&gt; I wouldn't say "don't bother with data structures", but rather "work a lot&nbsp; <br>&gt; with it and make pressure so that they get improved". besides Jonathan's&nbsp; <br>&gt; remarks, there are many other simple things that make life harder: lack of&nbsp; <br>&gt; methods for simple operations (select previous pointer, or previous/next X&nbsp; <br>&gt; pointers), math or expr functions inside of data-s templates (you need to&nbsp; <br>&gt; get the data and then set it again), can't delete scalars without using&nbsp; <br>&gt; the delete key or clearing the whole canvas, ...<br>&gt; many small things that make one patch a lot just to make simple operations.<br>&gt; and the biggest problem, rendering. don't even try to think of using&nbsp; <br>&gt; data-s for any high-rate GUI. for that better to look at GEM.<br>&gt; <br>&gt; looking at Miller's words, data structures was one of the main reasons to&nbsp; <br>&gt; start Pd. after all this time, they didn't change that much.<br>&gt; <br>&gt; very nice would be to have Ircam's FTM library implemented in Pd, but it&nbsp; <br>&gt; seems to be an impossible task, someone has tried already.<br>&gt; <br>&gt; <br>&gt; &gt; On Fre, 2013-05-24 at 16:13 -0700, Jonathan Wilkes wrote:<br>&gt; &gt;&gt; Here's a quickly made approach that uses quanta syntax and checks<br>&gt; &gt;&gt; for mouse manipulations from the outlet of [struct].<br>&gt; &gt;<br>&gt; &gt; Thanks a lot. A lot of new stuff (for me) in your example.<br>&gt; &gt;<br>&gt; &gt;&gt; I wouldn't recommend spending too much time learning data structures.<br>&gt; &gt;&gt; They are _extremely_ limited with the current implementation.<br>&gt; &gt;<br>&gt; &gt; I appreciate your advice. I have the impression one finds out about the<br>&gt; &gt; limitations only by diving into data structures a bit more deeply.<br>&gt; &gt; Although I haven't a clear picture yet what is possible and what is not,<br>&gt; &gt; I find some of the examples in Millers documentation quite intriguing.<br>&gt; &gt;<br>&gt; &gt; Roman<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;&gt; ----- Original Message -----<br>&gt; &gt;&gt; From: Roman Haefeli &lt;reduzent@gmail.com&gt;<br>&gt; &gt;&gt; To: pd-list &lt;pd-list@iem.at&gt;<br>&gt; &gt;&gt; Cc:<br>&gt; &gt;&gt; Sent: Friday, May 24, 2013 6:15 PM<br>&gt; &gt;&gt; Subject: [PD] first exercise with data structures<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Hi all<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Finally an attempt to dive into data structures. I read Frank<br>&gt; &gt;&gt; Barknecht's still excellent DS tutorial and, of course, section 4 of<br>&gt; &gt;&gt; Pd's help written by Miller Puckette, which is a bit more demanding, but<br>&gt; &gt;&gt; definitely very interesting. Though I can somewhat follow the simpler<br>&gt; &gt;&gt; example patches, the fundamental concepts are still a bit nebulous.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Here's my problem. I found how to use [filledpolygon] to draw a<br>&gt; &gt;&gt; rectangle whose width can be changed by mouse interaction. When using<br>&gt; &gt;&gt; the same [struct] as the element of an array, I can draw many rectangles<br>&gt; &gt;&gt; which can be grabbed and moved by the mouse (x-y-array). However, when<br>&gt; &gt;&gt; it is used as an element, the ability to change the width dynamically<br>&gt; &gt;&gt; with the mouse is lost.&nbsp; When it is not part of an array, it cannot be<br>&gt; &gt;&gt; moved easily (without going into edit mode). How can I have both at the<br>&gt; &gt;&gt; same time? Is it even possible at all?<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Attached is an example that illustrates both cases.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Roman<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; _______________________________________________<br>&gt; &gt;&gt; Pd-list@iem.at mailing list<br>&gt; &gt;&gt; UNSUBSCRIBE and account-management -&gt;&nbsp; <br>&gt; &gt;&gt; http://lists.puredata.info/listinfo/pd-list<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Pd-list@iem.at mailing list<br>&gt; &gt; UNSUBSCRIBE and account-management -&gt;&nbsp; <br>&gt; &gt; http://lists.puredata.info/listinfo/pd-list<br>&gt; <br>&gt; <br><br><br><br>_______________________________________________<br>Pd-list@iem.at mailing list<br>UNSUBSCRIBE and account-management -&gt; http://lists.puredata.info/listinfo/pd-list<br></body>