[R] stats:: spline's method could not be monoH.FC

Mark Leeds m@rk|eed@2 @end|ng |rom gm@||@com
Sun May 3 16:22:08 CEST 2020


Hi Abby: your questions are good but I can't help because I don't need to
actually use them
to that level of detail. I only have to understand it in its generalities.
Hopefully, Martin
or one of the other R-core people or guRus can answer your questions in a
definitive and clear
way.

But, as far as the term closure, I think that they referring to the
environment that
a function looks in after its looks in its own environment. So, if you
defined
a function say, foo, in the global environment, then the foo's closure is
the global
environment because, when finding the values of variables,  foo will first
look in its
environment  and then its closure. So, closure is just an environment
that's the parent
of a function's environment. It answers the question of where a function
looks next
when it can't find the values of some of the variables that it needs to
evaluate.

I'd also love to hear an explanation of "frame' because that term has
always confused me
I think ( emphasis on think ), when a function, foo,  gets called, it
creates a new
environment to evaluate its arguments and this new  environment of foo is
called a "frame".
But where is it and what is its parent ? Is "frame"  just a fancy term for
the
function's own environment ?  or is  the function's own environment the
parent of its evaluation
frame I'm not sure.

I have other documents that may help ( I recently did a document gathering
but I only read
the one I sent you )  but I think it's better to wait to see if anyone can
help here first. Then,
if not, I can send you some  other things. Oh, the slot question was also
interesting but I've never
used S4. Also, this list has gotten thinner over the years so another place
to ask is of course
stackoverflow.

























On Sun, May 3, 2020 at 6:19 AM Abby Spurdle <spurdle.a using gmail.com> wrote:

> Hi Mark,
>
> The article is good.
> However, there's still some grey areas.
>
> The documentation for base::typeof equates a closure with a function.
> However, the article defines a closure as a function together with an
> environment.
> A very minor difference I know, but it creates the problem that the
> word closure is used inconsistently.
> And that's without even getting into "frames".
>
> Equating a closure with a function (only), is perhaps misleading...???
>
> Also, re-iterating I use function objects with attributes.
> (I prefer this approach, because I can make copies of function
> objects, and if necessary modify them).
> My guess is that doesn't meet the definition of an R closure (if you
> ignore the environment)...???, and it's unclear whether it meets the
> definition of a closure, more generally...???
>
> So, I've still got the same problem, of how to refer to functions that
> have *either* attributes *or* environments, containing data.
> Maybe I should just stick to "Self-Referencing Function Objects" and
> "Functions Bundled with Data"...???
>
> One last thing, the last time I read S4 documentation, I couldn't tell
> if it was possible to have S4-based function objects, and if so, could
> the body of the S4-based function object (while being called) access
> it's own slots...???
>
>
> On Sun, May 3, 2020 at 4:27 PM Mark Leeds <markleeds2 using gmail.com> wrote:
> >
> > Abby: Here is an article on environments/closures which might be useful
> to you. I was reviewing environments recently and it
> > was a clear explanation of how environments/closures work in R. Even
> though it's from 2000, I'm pretty certain that everything
> > said in it still holds.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list