(define-syntax with-state/copy (syntax-rules () ((_ state body ...) (lambda (state) (let ((state (object-copy state))) body ... state))))) (define-syntax let-slots (ir-macro-transformer (lambda (e i c) (let* ((slots (caadr e)) (struct-name (cadadr e)) (struct (car (cddadr e))) (body (cddr e))) `(let ,(map (lambda (s) `(,(i s) (,(symbol-append (i struct-name) '- (i s)) ,struct))) slots) ,@(i body)))))) Used like (define-record s foo bar baz) (define s2 (make-s 1 2 3)) ((with-state/copy s (let-slots ((foo bar) s s2) (print "~a ~a" foo bar))) s2)