packages feed

Rlang-QQ-0.1.0.0: examples/test7.Rmd

# test 7
Same as test6, except needs a change to knitr as of October 2013 (ie. 1.5 is not good enough). [This commit is needed](https://github.com/yihui/knitr/pull/633).

This file can be loaded into whatever editor you like to use for knitr. I 
use [vim-r-plugin](http://www.vim.org/scripts/script.php?script_id=2628), but
perhaps ESS or Rstudio can also work. After some set-up in the first block. ghc is called for the second code block.

```{r engine='R'}
library(knitr)
opts_chunk$set(engine='haskell', engine.path='ghc',
               engine.opts='-e ":set -XQuasiQuotes" -e "import RlangQQ"')

```


```{r}

let fibs = 0.0:1: zipWith (+) fibs (drop 1 fibs)

[r| png('test6_fig1.png')
    plot(1:20, $(take 20 fibs))
    dev.off() |]

```

```{r}

do let x = 1
   print(1+x)
   print(2+x)

```

![test6 caption here](test6_fig1.png)

## limitations

* each block is a separate session. You would have to manually save/load variables defined in the previous chunk to make things work as they do for R.

* code is interpreted, not compiled

* graphical output from haskell chunks has to be manually included

## raw code
See [here](test7.Rmd.html)