Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread peter dalgaard
> On 21 Oct 2016, at 19:17 , Wilm Schumacher wrote: > > Am 21.10.2016 um 18:10 schrieb William Dunlap: >> Are you saying that >>f1 <- function(x) log(x) >>f2 <- function(x) { log } (x) >> should act differently? > yes. Or more precisely: I would expect that.

Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread Wilm Schumacher
Hi, Am 21.10.2016 um 18:10 schrieb William Dunlap: Are you saying that f1 <- function(x) log(x) f2 <- function(x) { log } (x) should act differently? yes. Or more precisely: I would expect that. "Should" implies, that I want to change something. I just want to understand the behavior

Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread luke-tierney
You might find it useful to look at what body() shows you for your example and to think about what return does. Best, luke On Fri, 21 Oct 2016, Wilm Schumacher wrote: Hi, thx for the reply. Unfortunately that is not a simplified version of the problem. You have a function, call it and get

Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread Wilm Schumacher
Hi, thx for the reply. Unfortunately that is not a simplified version of the problem. You have a function, call it and get the result (numeric in, numeric out in that case). For simplicity lets use the "return" case: ## foobar<-function(x) { return(sqrt(x)) }(2) ## which is a function (numeric

Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread William Dunlap via R-devel
Here is a simplified version of your problem > { sqrt }(c(2,4,8)) [1] 1.414214 2.00 2.828427 Do you want that to act differently? Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Oct 21, 2016 at 6:10 AM, Wilm Schumacher wrote: > Hi, > > I hope this is

Re: [Rd] anonymous function parsing bug?

2016-10-21 Thread Wilm Schumacher
Hi, sry for the double posting. I forgot to mention that this example ### f<-function(x) { return( 2*x ) }(2) class(f) f(3) f<-function(x) { return( 2*x ) }(4)(5) f(6) ### leads to ## > f<-function(x) { + return( 2*x ) + }(2) > > class(f) [1] "function" > > f(3) [1] 6 > >

[Rd] anonymous function parsing bug?

2016-10-21 Thread Wilm Schumacher
Hi, I hope this is the correct list for my question. I found a wired behaviour of my R installation on the evaluation of anonymous functions. minimal working example ### f<-function(x) { print( 2*x ) }(2) class(f) f(3) f<-function(x) { print( 2*x ) }(4)(5) f(6) ### leads to ###