From J.C.Rougier@durham.ac.uk  Fri Oct 13 12:07:26 2000
From: J.C.Rougier@durham.ac.uk (J.C.Rougier@durham.ac.uk)
Date: Fri, 13 Oct 2000 13:07:26 +0200 (MET DST)
Subject: [Rd] syntax confusion with function/non-function objects (PR#694)
Message-ID: <200010131107.NAA15331@pubhealth.ku.dk>

I'm just back from a computer practical where we ran into

> "f" <- function(x) 2(x^2) # for 2 * x^2

This definition was taken as legitimate, although using the
function generated the error message

> f(3)
Error in f(3) : attempt to apply non-function

Am I right in thinking that in prevous versions of R this
definition would have been declared as a syntax error?  Surely a
number before an opening parenthesis is always a syntax error?
The other mistake does this:

> "f" <- function(x) 2x^2 # another attempt at 2 * x^2
Error: syntax error

Cheers, Jonathan.

--please do not edit the information below--

Version:
 platform = sparc-sun-solaris2.7
 arch = sparc
 os = solaris2.7
 system = sparc, solaris2.7
 status = 
 major = 1
 minor = 1.1
 year = 2000
 month = August
 day = 15
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] syntax confusion with function/non-function objects (PR#694)
J.C.Rougier@durham.ac.uk