[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] Function in default parameter value closing over variables defined later in the enclosing fu
From:       Ivan Krylov <krylov.r00t () gmail ! com>
Date:       2019-01-26 13:39:20
Message-ID: 20190126163920.550389b9 () parabola
[Download RAW message or body]

On Thu, 24 Jan 2019 06:53:20 -0800
Jeff Newmiller <jdnewmil@dcn.davis.ca.us> wrote:

> It would be better to also make secret an argument to outside instead
> of a local variable or to give up on supplying the inside function as
> an argument.

This was in a small, mostly self-contained one-off script that tested
different design of experiment approaches with simulated datasets.

Actually, I should move the "secret" variable to the global level,
together with other global settings like the dataset size and noise
level. There it's accessible to both any functions that might be
interested in it and the user who might want to change it, after all.

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic