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.
Specify #lang for eval in Racket
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
© 2022 - 2024 — McMap. All rights reserved.