Better way to setup the sandbox input.
This commit is contained in:
parent
9884663697
commit
9f540bce01
|
@ -13,15 +13,14 @@
|
||||||
(list (car (sandbox-namespace-specs))
|
(list (car (sandbox-namespace-specs))
|
||||||
'typed/racket
|
'typed/racket
|
||||||
'typed/scheme)])
|
'typed/scheme)])
|
||||||
(let* ((lines (cdr (file->lines file))) ;; drop the #lang line
|
;; drop the #lang line
|
||||||
|
(let* ((prog (regexp-replace #rx"^#lang typed/(scheme|racket)(/base)?"
|
||||||
|
(file->string file) ""))
|
||||||
(in (if optimize?
|
(in (if optimize?
|
||||||
lines
|
prog
|
||||||
(cdr lines))) ;; drop the #:optimize
|
;; drop the #:optimize
|
||||||
(evaluator
|
(regexp-replace #rx"#:optimize" prog "")))
|
||||||
(make-evaluator 'typed/racket
|
(evaluator (make-evaluator 'typed/racket in))
|
||||||
(foldl (lambda (acc new)
|
|
||||||
(string-append new "\n" acc))
|
|
||||||
"" in)))
|
|
||||||
(out (get-output evaluator)))
|
(out (get-output evaluator)))
|
||||||
(kill-evaluator evaluator)
|
(kill-evaluator evaluator)
|
||||||
out)))))
|
out)))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user