fork download
  1. (defun bind-eval (vars values code)
  2. (let* ((src (format nil "(lambda ~a ~a)" vars code))
  3. (fun (eval (read-from-string src))))
  4. (apply fun values)))
  5.  
  6. (defmacro ceval (vars code)
  7. (loop :for var :in vars
  8. :collect var :into vars
  9. :collect var :into values
  10. :finally (return
  11. `(bind-eval (quote ,vars)
  12. (list ,@values)
  13. ,code))))
  14.  
  15. (defun test (x)
  16. (let ((y 1))
  17. (ceval (y) x)))
  18.  
  19. (print (test 'y))
Success #stdin #stdout 0.03s 10600KB
stdin
Standard input is empty
stdout
1