Hi list,
please excuse me if this has been discussed numerous times, but the search engine at https://lists.puredata.info/pipermail/pd-list/ does not give me reasonable answers.
I am writing an abstraction and for one of its numeric arguments I would like to detect if it has been not specified, or if it has been set to a float including 0. How can I do this?
I would also like to detect if another argument is a float or a symbol and process these two differently without causing Pd error messages. Is this possible?
Thank you! P
If you're ok with using an external library, then there is [pofutil] in the pof library which outputs a list of arguments when sent a [dollarg( message.
so, like:
[dollarg( | [pofutil]
You can then just use pd's list functions (list length, list split, etc) to pull that list apart and check its length, etc.
[route symbol float] should do the last bit you wanted,
if you're ok with externals you can also use [dollarg] from iemlib or [canvasargs] from iemguts. for a hacky vanilla solution, see attached patch. I'm sure there are more ways, this is just one that I remembered. Christof
Gesendet: Samstag, 22. Dezember 2018 um 16:52 Uhr Von: "Matt Davey" hard.off@gmail.com An: "Peter P." peterparker@fastmail.com Cc: pd-list pd-list@iem.at Betreff: Re: [PD] Abstraction arguments: tell apart symbols from floats from no argument at all
If you're ok with using an external library, then there is [pofutil] in the pof library which outputs a list of arguments when sent a [dollarg( message. so, like:
[dollarg( | [pofutil] You can then just use pd's list functions (list length, list split, etc) to pull that list apart and check its length, etc. [route symbol float] should do the last bit you wanted, _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
if you're ok with externals you can also use [dollarg] from iemlib or [canvasargs] from iemguts. for a hacky vanilla solution, see attached patch. I'm sure there are more ways, this is just one that I remembered.
And it is a nice one, Thanks Christof! P
another way to do it might be the following. I don't have now the time to
test it:
like [list $1 $2 $3 ... $16 or whatever])
If you know beforehand that 0s won't be part of the arguments, it will be
even easier, just filter out the 0s when detecting the argument type.
- Christof Ressi christof.ressi@gmx.at [2018-12-22 17:15]:
if you're ok with externals you can also use [dollarg] from iemlib or
[canvasargs] from iemguts. for a hacky vanilla solution, see attached
patch. I'm sure there are more ways, this is just one that I remembered.And it is a nice one, Thanks Christof!
unfortunately, this doesn't work. missing arguments will become 0 and therefore can't be differentiated from a float arg with with the same value. I think it's only dollarsyms (e.g. "_$1") where the missing argument doesn't become 0.
I think Pd vanilla really needs a mechanism to retreive the creation arguments as a list. personally I quite like $@.
Gesendet: Samstag, 22. Dezember 2018 um 19:00 Uhr Von: "João Pais" jmmmpais@gmail.com An: pd-list pd-list@iem.at, "Peter P." peterparker@fastmail.com Betreff: Re: [PD] Abstraction arguments: tell apart symbols from floats from no argument at all
another way to do it might be the following. I don't have now the time to
test it:
- loadbang a list with all the arguments (maybe initiated by something
like [list $1 $2 $3 ... $16 or whatever])
- use an abstraction from list-abs to drip the list
- send the output through a route to test the type
If you know beforehand that 0s won't be part of the arguments, it will be
even easier, just filter out the 0s when detecting the argument type.
- Christof Ressi christof.ressi@gmx.at [2018-12-22 17:15]:
if you're ok with externals you can also use [dollarg] from iemlib or
[canvasargs] from iemguts. for a hacky vanilla solution, see attached
patch. I'm sure there are more ways, this is just one that I remembered.And it is a nice one, Thanks Christof!
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
i have this vanilla abstraction based on a patch by johannes, which gives 1 for argument present and 0 if absent maybe thats for you?
best hans
Am 22.12.2018 um 16:52 schrieb Matt Davey hard.off@gmail.com:
If you're ok with using an external library, then there is [pofutil] in the pof library which outputs a list of arguments when sent a [dollarg( message.
so, like:
[dollarg( | [pofutil]
You can then just use pd's list functions (list length, list split, etc) to pull that list apart and check its length, etc.
[route symbol float] should do the last bit you wanted,
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
i have this vanilla abstraction based on a patch by johannes, which gives 1 for argument present and 0 if absent maybe thats for you?
Thanks Hans, this looks good and seems to be a similar way than the one proposed by Christof.
best, P
best hans
Here is a solution by Jonathan Wilkes that fetches the complete list of creation args including zeros.
Source: https://lists.puredata.info/pipermail/pd-list/2009-04/069941.html
On 22.12.18 19:52, Peter P. wrote:
- hans w. koch hansw.koch@gmail.com [2018-12-22 19:28]:
i have this vanilla abstraction based on a patch by johannes, which gives 1 for argument present and 0 if absent maybe thats for you?
Thanks Hans, this looks good and seems to be a similar way than the one proposed by Christof.
best, P
best hans
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list