View source: R/opt-loop-invariant.R
opt_loop_invariant | R Documentation |
Performs one loop-invariant code motion pass. Carefully examine the results after running this function!
opt_loop_invariant(texts)
texts |
A list of character vectors with the code to optimize. |
code <- paste(
"i <- 0",
"while (i < n) {",
" x <- y + z",
" a[i] <- 6 * i + x * x",
" i <- i + 1",
"}",
sep = "\n"
)
cat(opt_loop_invariant(list(code))$codes[[1]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.