RosettaCodeData/Task/Runtime-evaluation-In-an-environment/Racket/runtime-evaluation-in-an-environment-2.rkt

8 lines
189 B
Racket
Raw Permalink Normal View History

2013-06-05 21:47:54 +00:00
#lang racket
(define ns (make-base-namespace))
(define (eval-with-x code a b)
(define (with v)
(namespace-set-variable-value! 'x v #f ns)
(eval code ns))
(- (with b) (with a)))