On Tue, 1 Apr 2008, Dr. Ferdinand Jamitzky wrote:
> Anyway something like "yield" would be very nice to have.
> Would it be hard to implement?
Short answer: yes, it would be hard.
Longer answer: R's interpreter is based on lots of recursive C calls.
There are standard ways of implementing contin
Anyway something like "yield" would be very nice to have.
Would it be hard to implement?
It could be in a similar way to scala where you can define for-comprehensions.
I really miss them in R.
best wishes
ferdinand
On Tue, Apr 1, 2008 at 12:32 PM, Luke Tierney <[EMAIL PROTECTED]> wrote:
> No. Fir
Can I suggest some clarification of the help page for callCC
plainly stating that it is intended to exit from a deeply nested
set of calls.
On a casual reading I thought the exact same thing as f.jamitsky.
On Tue, Apr 1, 2008 at 6:32 AM, Luke Tierney <[EMAIL PROTECTED]> wrote:
> No. First class
No. First class continuations of the kind provided in scheme can be
used as a means to implement generators, but downward-only
continuations as currently provided in R are not sufficient for that.
This version is intended only as a non-local exit mechanism.
Best,
luke
On Mon, 31 Mar 2008, f.jam
callcc is similar to the "yield" keyword in python and c#
it lets you define e.g. a generator of lists of numbers.
Gabor Grothendieck wrote:
>
> Would anyone like to explain if callCC in R 2.7.0 gives
> anything that on.exit does not already provide?
>
> It seems that the exit condition once
Thanks. So its intended to jump straight out of deeply nested
calls without having to manage the unwinding.
On Sun, Mar 30, 2008 at 4:22 PM, Luke Tierney <[EMAIL PROTECTED]> wrote:
> On Sun, 30 Mar 2008, Gabor Grothendieck wrote:
>
> > Sorry it should be as follows:
> >
> > fib <- function(i, a =
On Sun, 30 Mar 2008, Gabor Grothendieck wrote:
> Sorry it should be as follows:
>
> fib <- function(i, a = 0, b = 1) {
> if (i == 0) b else fib(i-1, b, a+b)
> }
>
> Now, how do we transform that to use callCC?
>
>
> On Sun, Mar 30, 2008 at 1:42 PM, Gabor Grothendieck
> <[EMAIL PROTECTED]> wrote:
OK. Can you show code to implement the tail recursive version of
fib using callCC in R, say.
Here it is transformed to tail recursive style:
fib <- function(i, a = 0, b = 1) {
if (i == 0) a else fib(i-1, b, a+b)
Now, how do I add callCC to all this so that the fib call
presumably does not crea
On Sun, 30 Mar 2008, Gabor Grothendieck wrote:
> I think the only relationship to that is the name since
> it does not appear to allow one to leave a function
> in the middle of its processing and re-enter it back
> at that point -- which is what would be needed.
The article conflates basic CPS w
I came across this in googling for continuations and was surprised when
I found it in R 2.7.0 and since I had not come across it before I assumed
it was added just now.
Can you explain how its intended to be used with an example
that is more realistic than in the example section.
On Sun, Mar 30,
Sorry it should be as follows:
fib <- function(i, a = 0, b = 1) {
if (i == 0) b else fib(i-1, b, a+b)
}
Now, how do we transform that to use callCC?
On Sun, Mar 30, 2008 at 1:42 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> OK. Can you show code to implement the tail recursive version o
On Sun, 30 Mar 2008, Gabor Grothendieck wrote:
> Also in trying it out again it seems that its not like
> on.exit but more like return:
Yes -- if you can point out what in the documentation ever gave the
idea it might be like on.exit then we can fix the documentation.
>
> F <- function(f) { f(10
Also in trying it out again it seems that its not like
on.exit but more like return:
F <- function(f) { f(10); print(2); f(20); 3}
callCC(F)
acts the same as:
F <- function() { return(10); print(2); f(20); 3}
F()
and there is no documented way to restart F
at the point it left off so I assume i
I think the only relationship to that is the name since
it does not appear to allow one to leave a function
in the middle of its processing and re-enter it back
at that point -- which is what would be needed.
On Sun, Mar 30, 2008 at 12:04 PM, <[EMAIL PROTECTED]> wrote:
>
> > Would anyone like to
> Would anyone like to explain if callCC in R 2.7.0 gives
> anything that on.exit does not already provide?
>
> It seems that the exit condition once defined cannot
> be added to overridden whereas with on.exit multiple
> on.exit's add additional on.exits rather than being ignored.
>
> Is this impo
Would anyone like to explain if callCC in R 2.7.0 gives
anything that on.exit does not already provide?
It seems that the exit condition once defined cannot
be added to overridden whereas with on.exit multiple
on.exit's add additional on.exits rather than being ignored.
Is this important?
__
16 matches
Mail list logo