x
x
x


Do so in a way which:

 does not involve string manipulation of the input source code
 is plausibly extensible to a runtime-chosen set of bindings rather than just x
 does not make x a global variable


or note that these are impossible.



See also

 For more general examples and language-specific details, see Eval.
 Dynamic variable names is a similar task.


 
(define (eval-with-x prog x)
    (eval prog (environment-new (list (list 'x x)))))
 
(define prog '( + 1 (* x x)))
 
(eval-with-x prog 10) → 101
(eval-with-x prog 1000) → 1000001
(- (eval-with-x prog 1000) (eval-with-x prog 10)) → 999900
 
;; check x is unbound (no global)
x
😖️ error: #|user| : unbound variable : x
 