[PD] expr size() refuses some array names

Derek Holzer derek at umatic.nl
Sat Mar 27 21:04:44 CET 2010


What if you bang a [f $1] and send it to [expr size("$1foo")]?

Likewise with "bang"--->[f $0]--->[expr size("$0foo")]?

I didn't know about  [expr size("arrayname")] before, would be great if 
it was widely usable!

D.

On 3/27/10 8:57 PM, Matteo Sisti Sette wrote:
> Hi,
>
> When trying to use [expr size("arrayname")] to get the size of an array,
> some array names that are legal in Pd will cause (sometimes funny)
> syntax errors in [expr].
>
> It seems that for example:
> - array name cannot start with a number (or a $n)
> (it can contain a number or dollar in the middle or end)
> - array name cannot contain a minus sign ("-")
> (nor I guess *, + and /)
>
> and maybe other restrictions.
>
> For example:
>
> 1) [expr size("$0foo")]
>
> expr: syntax error: 1005foo")
>
> 2) [expr size("$1foo")]
>
> expr: syntax error: $1foo")
>
> 3) [expr size("foo-bar")]
>
> expr: syntax error: missing '"'
>
>
> Seems like quotes are not treated quite like one would expect...
>
> Is there a way to work it around, or do you have to restrict array names
> (of which you're gonna need to know the size) to the typical rules that
> apply to identifier names in many popular programming languages? (but
> then, why are quotes needed at all??)
>
>
> thanks
> m.
>

-- 
::: derek holzer ::: http://macumbista.net :::
---Oblique Strategy # 181:
"What would your closest friend do?"




More information about the Pd-list mailing list