[PD] default abstraction argument(s)

IOhannes m zmoelnig zmoelnig at iem.at
Thu Dec 16 09:42:31 CET 2004

Federico wrote:
> On Thu, 16 Dec 2004 08:07:16 +0100
> Frank Barknecht <fbar at footils.org> wrote:
>>>but if i omit $2, the float's value is 0 and not 1.
>>>how to test if a creation parameter was specified?
>>You test, if it's 0! 
>>  loadbang
>>  |
>>  [f $2]
>>  |
>>  [select  0]
>>  |         |
>>  [default( |
>>  |        /
>>  [s something]
>>Replace "default" with your default.
> in this case, if i specify 0 as second argument, internally i get
> [default-value] instead of zero.

> in other programming languages, you can test $2 against a null val, or
> you can check the argument count...

yes, that is in other languages.
(well, what frank proposed was basically a testing against a null-val)

in (pure) pd this is unsfortunately not possible yet, which brings back 
the issue of (argc,argv) pairs, both for messages and patch-arguments.
i would strongly vote vor $# and $@ as it is bash-compatible, and (for 
me) it is pd-compatible too: it only uses one letter, and this letter is 
somewhat special (unlike $n)

there is a [$n] object in the iemlib, that gives you both the length and 
the list of arguments of the patch it is in.


More information about the Pd-list mailing list