Description Usage Arguments Value Examples

This function parses a dynamic programming recursion expression and evaluates it, returning the table that the recursions specify.

1 | ```
recursion %where% ranges
``` |

`recursion` |
Specification of the dynamic programming recursion. |

`ranges` |
Specification of the index-ranges the recursion should compute values over. |

A filled out dynamic programming table.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
# Fibonnaci numbers
fib <- {
F[n] <- 1 ? n <= 2
F[n] <- F[n-1] + F[n-2]
} %where% {
n <- 1:10
}
fib
# Edit distance
x <- c("a", "b", "c")
y <- c("a", "b", "b", "c")
edit <- {
E[1,j] <- j - 1
E[i,1] <- i - 1
E[i,j] <- min(
E[i - 1,j] + 1,
E[i,j - 1] + 1,
E[i - 1,j - 1] + (x[i - 1] != y[j - 1])
)
} %where% {
i <- 1:(length(x) + 1)
j <- 1:(length(y) + 1)
}
edit
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.