<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Collect all arguments as a list]]></title><description><![CDATA[<p>Hi,<br />
is there a way (preferably vanilla) to collect all the arguments of an abstraction into a list? Something like:<br />
<img src="/uploads/files/1500379497913-screen-shot-2017-07-18-at-14.04.38.png" alt="Screen Shot 2017-07-18 at 14.04.38.png" class="img-responsive img-markdown" /></p>
<p>The number of arguments is not fixed.</p>
<p>Thanks in advance for your help.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 15:26:40 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/10892.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Jul 2017 12:05:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 12:05:18 GMT]]></title><description><![CDATA[<p>Hi,<br />
is there a way (preferably vanilla) to collect all the arguments of an abstraction into a list? Something like:<br />
<img src="/uploads/files/1500379497913-screen-shot-2017-07-18-at-14.04.38.png" alt="Screen Shot 2017-07-18 at 14.04.38.png" class="img-responsive img-markdown" /></p>
<p>The number of arguments is not fixed.</p>
<p>Thanks in advance for your help.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Tue, 18 Jul 2017 12:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 13:05:12 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/weightless">@weightless</a> the safe way to get floats as well as symbols is <code>[list append $1 $2 $3]</code>. To write &quot;list append&quot; not just &quot;list&quot; is the important part here (list prepend also works).</p>
<p>i think it is not possible to get the number of arguments in vanilla.</p>
<p>Possible solutions in vanilla:</p>
<ul>
<li>create a long list like above, read the list until it is zero</li>
<li>dynamically create such list with one argument at a time until it is zero</li>
<li>make the first argument the number of arguments and create the list with the right length to get the exact number. The other methods are only exact if you are certain that arguments are non-zero, at least at the end. An alternative would be to put a certain stop argument at the end.</li>
</ul>
<p>In iemlib there is [dollarg], which does it.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/2</guid><dc:creator><![CDATA[ingox]]></dc:creator><pubDate>Tue, 18 Jul 2017 13:05:12 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 13:19:45 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ingox">@ingox</a> Thanks for the explanation, they are all good methods although unfortunately the arguments can be zero.<br />
For now I wouldn't mind using an external if there is one just to get it going, but [dollarg] does not create. In fact, there is only the help file in the library I have downloaded and I'm not sure why.</p>
<p>EDIT: I downloaded the other version of iemlib from Deken and this one works. Thanks, I will use [dollarg] for now. If anybody else can come up with a universal way to do it vanilla-style that would be very interesting, but like you said it mightn't be possible.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/3</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Tue, 18 Jul 2017 13:19:45 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 13:51:53 GMT]]></title><description><![CDATA[<p>Pd Vanilla only has one way to do that-- exploit the inconsistency in dollsymarg and dollararg expansion for non-existent abstraction arguments.</p>
<p>For example-- suppose our parent abstraction is [foo 0]. Inside that abstraction we try <code>[list append $1]</code> which gives &quot;0&quot;. We also try <code>[list append $1-sym]</code> which gives &quot;0-sym&quot;. But we don't know if that means the abstraction arg was zero or there was no abstraction arg given.</p>
<p>So let us try abstraction <code>[foo]</code> with no args. Now inside foo we create <code>[list append $1]</code> which again gives us &quot;0&quot;. That's no help at all. But now look at the output from <code>[list append $1-sym]</code>:</p>
<p><code>symbol \\$1-sym</code></p>
<p>When &quot;$1&quot; doesn't exist, Pd's string concatenation algorithm doesn't expand the dollararg to 0 but instead quotes it directly. Weird.</p>
<p>So now we've got an algorithm for finding the length of the list of args, which consequently means we can reproduce that list of args inside the abstraction:</p>
<pre><code>(pseudocode)
check if [list append $1]--[$1-sym( is equal to [list append $1-sym]
if it isn't then you've got one less arguments than the dollararg you tried.
if it is equal then &quot;add2&quot; the value of the dollararg into a msg box and try with the next biggest dollarsign variable
...
at the end, bang out the msg box to get the full list of args
</code></pre>
<p>Notice that you must do this inside the canvas or subcanvas where you want to get the arguments. So you cannot modularize this algorithm inside an abstraction-- you must always paste a subpatch inside the relevant abstraction.</p>
<p>Or in Purr Data you can just do this:</p>
<pre><code>[list append $@]
</code></pre>
<p>or this:</p>
<pre><code>[args(
|
[canvasinfo]
</code></pre>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/4</guid><dc:creator><![CDATA[jancsika]]></dc:creator><pubDate>Tue, 18 Jul 2017 13:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 21:46:51 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jancsika">@jancsika</a> This is a great trick, thanks for taking the time to explain it. I got it to work by patching your algorithm, here it is:</p>
<p><a href="/uploads/files/1500413606148-get.arguments.vanilla.zip">get.arguments.vanilla.zip</a></p>
<p>This obviously needs to iterate a given number of arguments, which are pre-typed in the two [list append] objects. One step further would be to be able to have an indefinite number of arguments, and retrive the next one after each step. I tried like this and it doesn't work:<br />
<img src="/uploads/files/1500413901018-screen-shot-2017-07-18-at-23.38.12.png" alt="Screen Shot 2017-07-18 at 23.38.12.png" class="img-responsive img-markdown" /></p>
<p>(and obviously break the [until] loop after the first non-match), but I don't think it's possible to set [float] or [list] to $n via the right inlet, but I'd love to hear if somebody knows how to.</p>
<p>The only other two ways I can think of to get around this is to either create each [list append $n] dinamically (might get tricky) or to just use the approach in the patch and pre-set the [list append]s to the maximum number of possible arguments an object can have (don't know if there is such a thing).</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/5</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Tue, 18 Jul 2017 21:46:51 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 22:36:51 GMT]]></title><description><![CDATA[<p>There are two demos floating around on Pd user list-- one by Matt Barber and another by me. We both had to resort to dynamic patching, which is indeed tricky.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/6</guid><dc:creator><![CDATA[jancsika]]></dc:creator><pubDate>Tue, 18 Jul 2017 22:36:51 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Tue, 18 Jul 2017 23:40:55 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/weightless">@weightless</a> Here is yet another solution:</p>
<p><a href="/uploads/files/1500420980281-dollarg.zip">dollarg.zip</a></p>
<p>This also uses dynamic patching and the trick <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jancsika">@jancsika</a> described above. <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/grinning.png" title=":)" alt=":)" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/7</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/7</guid><dc:creator><![CDATA[ingox]]></dc:creator><pubDate>Tue, 18 Jul 2017 23:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Wed, 19 Jul 2017 07:13:46 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ingox">@ingox</a> This is excellent, and it works with nested arguments as well.<br />
<img src="/uploads/files/1500448398028-screen-shot-2017-07-19-at-09.13.06.png" alt="Screen Shot 2017-07-19 at 09.13.06.png" class="img-responsive img-markdown" /></p>
<p>Thanks a lot everyone!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/8</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/8</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Wed, 19 Jul 2017 07:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Wed, 19 Jul 2017 08:03:17 GMT]]></title><description><![CDATA[<p>I've updated <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ingox">@ingox</a> patch so now it works similar to [dollarg] and can output individual arguments as well. See inside the patch for more info.</p>
<p><a href="/uploads/files/1500451377122-get.dollarg.zip">get.dollarg.zip</a></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/9</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/9</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Wed, 19 Jul 2017 08:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Wed, 19 Jul 2017 16:39:49 GMT]]></title><description><![CDATA[<p>Here is the solution of Jonathan Wilkes (i guess that is you, <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jancsika">@jancsika</a>):<br />
<a href="/uploads/files/1500482196162-creationargs.zip">creationargs.zip</a><br />
from <a href="https://lists.puredata.info/pipermail/pd-list/2009-04/069941.html" rel="nofollow">https://lists.puredata.info/pipermail/pd-list/2009-04/069941.html</a></p>
<p>It is shorter and more elegant than mine. <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/grinning.png" title=":)" alt=":)" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/10</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/10</guid><dc:creator><![CDATA[ingox]]></dc:creator><pubDate>Wed, 19 Jul 2017 16:39:49 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Thu, 20 Jul 2017 14:10:19 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/ingox">@ingox</a> this gets better and better! here is the patch updated with the shorter code:</p>
<p><a href="/uploads/files/1500558988434-get.dollarg.zip">get.dollarg.zip</a></p>
<p>Thanks again everyone, this looks reliable enough to be used instead of the external.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/11</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/11</guid><dc:creator><![CDATA[weightless]]></dc:creator><pubDate>Thu, 20 Jul 2017 14:10:19 GMT</pubDate></item><item><title><![CDATA[Reply to Collect all arguments as a list on Mon, 08 Nov 2021 17:17:00 GMT]]></title><description><![CDATA[<p>updating the conversation to say vanilla now has had [pdcontrol] for that for a while</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/12</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/10892/collect-all-arguments-as-a-list/12</guid><dc:creator><![CDATA[porres]]></dc:creator><pubDate>Mon, 08 Nov 2021 17:17:00 GMT</pubDate></item></channel></rss>