For that particular case your modification works, but when I do

sandbox (lambda (1)))

I get:

; in: LAMBDA NIL                                                                
;     (LAMBDA (1))                                                              
; ==>                                                                           
;   #'(LAMBDA (1))                                                              
;                                                                               
; caught ERROR:                                                                 
;   Required argument is not a symbol: 1                                        
;                                                                               
; compilation unit finished                                                     
;   caught 1 ERROR condition

2011/5/6 Stas Boukarev <stassats@gmail.com>
Semion Prihodko <semion.ababo@gmail.com> writes:

> Hi guys,
>
> Have a little problem. I perform some experiments with genetic programming
> and need to disable all output from a randomly-generated program (need only
> its return value).
>
> For this purpose I wrote the following macro:
>
> (defmacro sandbox (&body body)
>   `(ignore-errors
>      (locally (declare #+sbcl(sb-ext:muffle-conditions warning))
>        ,@body)))
>
> This approach works good for me, except macro expansion errors
> (unfortunately lambda is a macro). For example, when I input:
What about
(defmacro sandbox (&body body)
 `(ignore-errors
    (eval '(locally (declare #+sbcl(sb-ext:muffle-conditions warning))
            ,@body))))

--
With best regards, Stas.