I'm new to Lisp, so I apologize in advance if the answer should be obvious. I want to write a macro that prevents code from having any side effects. Using = or zap in the code itself is fine, that should just be undone once the block exits. The motivation is to be able to run untrusted code - I figure I can mock out system primitives, but I also need to keep from running stuff like (= no nil), and to keep different untrusted bits of code from interfering with each other. E.g. I want to be able to do something like > (= foo 2) 2 > (no-side-effects
(= foo 3)
(= bar 4)
(+ foo bar)
) 7 > foo 2 > bar Error: "reference to undefined identifier: _bar" I'd appreciate advice from some of the experts out there! |