From ggrothendieck @ending from gm@il@com  Sun Sep 23 19:06:01 2018
From: ggrothendieck @ending from gm@il@com (Gabor Grothendieck)
Date: Sun, 23 Sep 2018 13:06:01 -0400
Subject: [Rd] Recall
In-Reply-To: <CAP01uRm5Cuu0RgU_BznfrUHmQLRz9re92ND6uqeR+8vaP8pN3Q@mail.gmail.com>
References: <CAP01uRm5Cuu0RgU_BznfrUHmQLRz9re92ND6uqeR+8vaP8pN3Q@mail.gmail.com>
Message-ID: <CAP01uR=XoLfW6nYj_Pw2okrtGwKZKSNFpGYkiydY5D7y6AQ7Ug@mail.gmail.com>

Please ignore. Looking at this again I realize the problem is that
Recall is not direclty within my.compose2 but rather is within the
anonymous function in the else.
On Sun, Sep 23, 2018 at 9:23 AM Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> This works:
>
>   my.compose <- function(f, ...) {
>     if (missing(f)) identity
>     else function(x) f(my.compose(...)(x))
>   }
>
>   my.compose(sin, cos, tan)(pi/4)
>   ## [1] 0.5143953
>
>   sin(cos(tan(pi/4)))
>   ## [1] 0.5143953
>
> But replacing my.compose with Recall in the else causes it to fail:
>
>   my.compose2 <- function(f, ...) {
>     if (missing(f)) identity
>     else function(x) f(Recall(...)(x))
>   }
>
>   my.compose2(sin, cos, tan)(pi/4)
>   ## Error in my.compose2(sin, cos, tan)(pi/4) : unused argument (tan)
>
> Seems like a bug in R.
>
> This is taken from:
> https://stackoverflow.com/questions/52463170/a-recursive-compose-function-in-r
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



[Rd] Recall
Gabor Grothendieck