Reputation: 437
I want to use a specific #lang in eval to provide it its semantics. However, eval itself does not appear to have a mechanism to specify the language, and passing in #lang does not seem to work.
Upvotes: 8
Views: 171
Reputation: 8373
You can use make-module-evaluator
from racket/sandbox
for that.
> (require racket/sandbox)
> (define evaluator (make-module-evaluator "#lang racket/base"))
> (evaluator '(+ 1 2))
3
> (evaluator "(+ 1 2)")
3
Upvotes: 9