Mercurial > pub > dyncall > bindings
comparison R/rdyncall/demo/factorial.R @ 0:0cfcc391201f
initial from svn dyncall-1745
| author | Daniel Adler |
|---|---|
| date | Thu, 19 Mar 2015 22:26:28 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:0cfcc391201f |
|---|---|
| 1 f <- function(i,fun) | |
| 2 { | |
| 3 if (i > 1) i * .dyncall(fun,"ip)i",i-1,fun) else i | |
| 4 } | |
| 5 e <- new.env() | |
| 6 cb <- new.callback("ip)i", f,e) | |
| 7 e <- NULL | |
| 8 f <- NULL | |
| 9 gc() | |
| 10 r <- .dyncall(cb,"ip)i",12,cb) | |
| 11 r == factorial(12) | |
| 12 cb <- NULL | |
| 13 gc() |
