[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function space
From: |
Ben Abbott |
Subject: |
Re: function space |
Date: |
Tue, 21 Feb 2012 14:29:21 -0500 |
On Feb 21, 2012, at 2:24 PM, Vic Norton wrote:
> In the manual or help there seems to be a preference to write
> 'sin (X)' rather than 'sin(X)'
> or
> 'sprintf ("%d", i)' rather than 'sprintf("%d", i)'.
> However, in at least one case, the space between the function name and its
> argument list results in a "parse error".
>
> For example
> i = 5;
> x = [ "min", sprintf("%d", i) ];
> results in
> x = "min5".
> However
> i = 5;
> x = [ "min", sprintf ("%d", i) ];
> results in
> parse error:
>
> syntax error
>
>>>> x = [ "min", sprintf ("%d", i) ];
>
>
> Is this a bug? Or should one just avoid putting a space after a function name?
>
> In what other situations does a space after a function name result in a
> syntax error?
>
> Regards,
>
> Vic
Its not a bug. Spaces and comma's are delimiters in a comma-separated-list
(cs-list).
[1 2 3]
ans =
1 2 3
[1, 2, 3]
ans =
1 2 3
[1, 23]
ans =
1 23
Ben