Skip to content
Back to formatted view

Raw Message

Message-ID: <c515124de8c715a888df71b7b2f6df45@soc.soton.ac.uk>
Date: 2005-05-20T14:21:24Z
From: robin hankin
Subject: R annoyances
In-Reply-To: <39B6DDB9048D0F4DAD42CB26AAFF0AFA64E860@usctmx1106.merck.com>

On May 20, 2005, at 01:14 pm, Liaw, Andy wrote:

[snip]

>> R uses round brackets in two unrelated ways:
>>
>>   4*(1+2)  --- using "(" and ")" to signify grouping
>> f(8)  function f() evaluated at 8.
>>
>> where there is no reason to use the same parenthesis symbol for both
>> tasks.
>
> The same is done in Fortran/C/C++/Java/Python and God knows how many
> others...
>

well yes, but that doesn't mean it's the Right Thing To Do (tm).

Gabor points out that "f(10)" having meaning whether f is a vector or a 
function
is interesting.  I guess this is right, but I can't think of a 
real-life situation in which
this would be useful.


>> IMO, the only system with consistent parenthesis use is Mathematica;
>>
>> f[10]  #  function f[] evaluated at 10
>> 8*(2+2)   # parenthesis to override  order of operations
>> f[[3]] # third element of list f
>>
>> {} are used for sets.
>
> Just out of curiosity, what's used for grouping expressions?
>

all statements on a line are executed sequentially.   Execution 
continues to next line
if there are any unmatched parentheses or dangling operators.

  So it's a bit pythonesque.


> Andy
>
>

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743