Displaying 6 results from an estimated 6 matches for "factorial_tr_4".
Did you mean:
factorial_tr_1
2018 Feb 11
4
Parallel assignments and goto
...parallel assignment, and I could hack my way out of using `with` or `bind` in rewriting `cases`, but restarting a `repeat` loop would really make for a nicer solution. I know that `goto` is considered harmful, but really, in this case, it is what I want.
A `callCC` version also solves the problem
factorial_tr_4 <- function(n, acc = 1) {
function_body <- function(continuation) {
if (n <= 1) {
continuation(acc)
} else {
continuation(list("continue", n = n - 1, acc = acc * n))
}
}
repeat {
result <- callCC(function_body...
2018 Feb 11
0
Parallel assignments and goto
...and I could hack my way out of using `with` or `bind` in rewriting `cases`, but restarting a `repeat` loop would really make for a nicer solution. I know that `goto` is considered harmful, but really, in this case, it is what I want.
>
> A `callCC` version also solves the problem
>
> factorial_tr_4 <- function(n, acc = 1) {
> function_body <- function(continuation) {
> if (n <= 1) {
> continuation(acc)
> } else {
> continuation(list("continue", n = n - 1, acc = acc * n))
> }
> }
> repeat {
>...
2018 Feb 26
0
Parallel assignments and goto
...t, and I could hack my way out of using `with` or `bind` in rewriting `cases`, but restarting a `repeat` loop would really make for a nicer solution. I know that `goto` is considered harmful, but really, in this case, it is what I want.
>
> A `callCC` version also solves the problem
>
> factorial_tr_4 <- function(n, acc = 1) {
> function_body <- function(continuation) {
> if (n <= 1) {
> continuation(acc)
> } else {
> continuation(list("continue", n = n - 1, acc = acc * n))
> }
> }
> repeat {
> result <- callCC(function_body)
> if (is.list(resu...
2018 Feb 14
0
Parallel assignments and goto
...ld hack my way out of using `with` or `bind` in rewriting `cases`, but
> restarting a `repeat` loop would really make for a nicer solution. I know that
> `goto` is considered harmful, but really, in this case, it is what I want.
>
> A `callCC` version also solves the problem
>
> factorial_tr_4 <- function(n, acc = 1) {
> function_body <- function(continuation) {
> if (n <= 1) {
> continuation(acc)
> } else {
> continuation(list("continue", n = n - 1, acc = acc * n))
> }
> }
> repeat {
&...
2018 Feb 27
2
Parallel assignments and goto
...my way out of using `with` or `bind` in rewriting `cases`, but restarting a `repeat` loop would really make for a nicer solution. I know that `goto` is considered harmful, but really, in this case, it is what I want.
> >
> > A `callCC` version also solves the problem
> >
> > factorial_tr_4 <- function(n, acc = 1) {
> > function_body <- function(continuation) {
> > if (n <= 1) {
> > continuation(acc)
> > } else {
> > continuation(list("continue", n = n - 1, acc = acc * n))
> > }
> > }
> > repeat {
> > result <...
2018 Feb 27
0
Parallel assignments and goto
...` in
> rewriting `cases`, but restarting a `repeat` loop would really make for a
> nicer solution. I know that `goto` is considered harmful, but really, in
> this case, it is what I want.
> > >
> > > A `callCC` version also solves the problem
> > >
> > > factorial_tr_4 <- function(n, acc = 1) {
> > > function_body <- function(continuation) {
> > > if (n <= 1) {
> > > continuation(acc)
> > > } else {
> > > continuation(list("continue", n = n - 1, acc = acc * n))
> > > }
> > > }
>...