Skip to content
Back to formatted view

Raw Message

Message-ID: <20101203183532.7d202718@bossiaea>
Date: 2010-12-03T10:35:32Z
From: Berwin A Turlach
Subject: using ``<-'' in function argument
In-Reply-To: <4CF8BE72.4020402@uni-hamburg.de>

G'day Ivan,

On Fri, 03 Dec 2010 10:54:58 +0100
Ivan Calandra <ivan.calandra at uni-hamburg.de> wrote:

> Arf, yes it makes sense now!

Well, my original post said: "R has lazy evaluation" and "the
assignment takes place when the function evaluates the argument" :)

> So the idea here is: never use "<-" in function argument...

Never say never. :)

But if you want to perform a (global) assignment within an actual
argument to a function, you should better be sure that the
formal argument gets evaluated.  In fact, this trick is probably a good
way, short of studying the source, to find out whether an argument gets
evaluated or not (or only occasionally).

Cheers,

	Berwin