Re: [Rd] Patch for setwd() to show path in error message

2013-01-12 Thread Henrik Bengtsson
On Fri, Jan 11, 2013 at 10:40 PM, Prof Brian Ripley wrote: > On 11/01/2013 20:22, Henrik Bengtsson wrote: >> >> Below is a patch for setwd() to show path in error message. Current >> it just gives error messages such as: >> >> Error in setwd(libdir) : cannot change working directory >> >> with th

Re: [Rd] Tricking Promises into Sending Info Via Args into Caller

2013-01-12 Thread Henrik Bengtsson
In the spirit of this, but AFAIK not due to lazy evaluation, here's another illustration why it's easy to mistakes when doing "inline" assignments: > x <- 0 > TRUE && (x <- 1) [1] TRUE > x [1] 1 > FALSE && (x <- 2) [1] FALSE > x [1] 1 > (x <- 3) && FALSE [1] FALSE > x [1] 3 > FALSE & (x <- 4) [

Re: [Rd] Tricking Promises into Sending Info Via Args into Caller

2013-01-12 Thread peter dalgaard
On Jan 12, 2013, at 17:02 , Gabor Grothendieck wrote: > The is.pos function below results in the variable, out, being set to > TRUE if the first argument to is.pos is positive and to FALSE > otherwise. > > It does this without using the return value or using scoping tricks to > reach into the ca

[Rd] Tricking Promises into Sending Info Via Args into Caller

2013-01-12 Thread Gabor Grothendieck
The is.pos function below results in the variable, out, being set to TRUE if the first argument to is.pos is positive and to FALSE otherwise. It does this without using the return value or using scoping tricks to reach into the caller. Instead it tricks the promise into communicating one bit of i