search for: match_env

Displaying 4 results from an estimated 4 matches for "match_env".

2018 Feb 26
0
Parallel assignments and goto
..., ? ? ? ? ? CONS(car, cdr) -> llength(cdr, acc + 1)) } The tail-recursion I get out of transforming this function looks like this: llength_tr <- function (llist, acc = 0) { ? ? .tailr_env <- rlang::get_env() ? ? callCC(function(escape) { ? ? ? ? repeat { ? ? ? ? ? ? if (!rlang::is_null(..match_env <- test_pattern(llist, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NIL))) ? ? ? ? ? ? ? ? with(..match_env, escape(acc)) ? ? ? ? ? ? else if (!rlang::is_null(..match_env <- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?test_pattern(llist, CONS(car, cdr)))) ? ? ? ? ? ? ? ? with(..match...
2018 Feb 27
2
Parallel assignments and goto
...r, acc + 1)) > } > > The tail-recursion I get out of transforming this function looks like this: > > llength_tr <- function (llist, acc = 0) { > ? ? .tailr_env <- rlang::get_env() > ? ? callCC(function(escape) { > ? ? ? ? repeat { > ? ? ? ? ? ? if (!rlang::is_null(..match_env <- test_pattern(llist, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NIL))) > ? ? ? ? ? ? ? ? with(..match_env, escape(acc)) > > ? ? ? ? ? ? else if (!rlang::is_null(..match_env <- > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?test_pattern(llist, CONS(car, cdr)))) >...
2018 Feb 27
0
Parallel assignments and goto
...ail-recursion I get out of transforming this function looks like > this: > > > > llength_tr <- function (llist, acc = 0) { > > .tailr_env <- rlang::get_env() > > callCC(function(escape) { > > repeat { > > if (!rlang::is_null(..match_env <- test_pattern(llist, > > NIL))) > > with(..match_env, escape(acc)) > > > > else if (!rlang::is_null(..match_env <- > > test_pattern(llis...
2018 Feb 11
4
Parallel assignments and goto
Hi guys, I am working on some code for automatically translating recursive functions into looping functions to implemented tail-recursion optimisations. See https://github.com/mailund/tailr As a toy-example, consider the factorial function factorial <- function(n, acc = 1) { if (n <= 1) acc else factorial(n - 1, acc * n) } I can automatically translate this into the loop-version