<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 20, 2010, at 11:16 PM, Nikita B. Zuev wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Thank you all for your replies. I somehow missed `struct-copy', this<br>is exactly what I wanted. Bad thing I can't pass lambda to it like:<br><br>(struct-copy person<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myperson<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(age (lambda (age) (+ age 1))))<br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>struct-copy expects an expression, so the lambda isn't necessary. It doesn't require id's in the expression to be from the same structure (or to be part of a structure at all). If you are writing a lot of code that requires a special form like the above, then you can write a function or macro to do it. The following expression is just as short and easy (easier?) to read, anyway.</div><div><br></div><div><div>(struct-copy person&nbsp;myperson&nbsp;(age (+ 1 (person-age myperson))))</div><div><br></div><div>rac</div></div></body></html>