help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function space


From: Jordi Gutiérrez Hermoso
Subject: Re: function space
Date: Tue, 21 Feb 2012 14:38:45 -0500

On 21 February 2012 14:24, Vic Norton <address@hidden> 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".

Yes, this is the preferred style because it consistently documents if
a(x) is a function call or an indexing. Function calls get the space,
indexing doesn't. It's part of the general GNU style, which has a bit
of a lisp flavour:

    http://www.gnu.org/prep/standards/standards.html#Formatting

However, for the case when you want this inside a [], you have to do
instead

    [(a (x)), b]

It's also acceptable to omit that space in such cases, and we
sometimes do that too in the Octave sources.

- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]