help-octave
[Top][All Lists]
Advanced

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

Re: function space


From: Sergei Steshenko
Subject: Re: function space
Date: Tue, 21 Feb 2012 13:32:45 -0800 (PST)


--- On Tue, 2/21/12, CdeMills <address@hidden> wrote:

> From: CdeMills <address@hidden>
> Subject: Re: function space
> To: address@hidden
> Date: Tuesday, February 21, 2012, 12:49 PM
> The choice was made, in the design of
> scripts, to have
> a (x)
> 
> mean both 'call the function "a" with argument "x"' and
> 'take the component
> at index "x" of vector "a".
> The choice is made depending on the existing of a function
> called "a" or a
> variable called "a". This is the opposite of the C language,
> where the array
> access operator, "[", is different from function call "(".
> 
> So the additionnal space in the docs is there to emphasise
> the fact that
> parens are used in the context of function call. Now the "["
> make the
> interpreter enter a specific mode, where space counts. So
> a =[ sin (x) ]  
> 
> becomes incorrect, as the interpreter tries to call sin
> without arguments.
> 
> Regards
> 
> Pascal
> 
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/function-space-tp4408021p4408264.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
> _______________________________________________


To add to the confusion:

"
octave:1> foo = [1 2 3]
foo =

   1   2   3

octave:2> bar = [4 foo (2) 5]
bar =

   4   1   2   3   2   5

octave:3> bar = [4 foo(2) 5]
bar =

   4   2   5

octave:4> bar = [4 (foo (2)) 5]
bar =

   4   2   5

octave:5> 
".

Looks like a definitional (of the "m-language") defect to me.

Regards,
  Sergei.

P.S. I hate both Python and 'make' languages for meaningful whitespaces.



reply via email to

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