Hi, <br><br>I'm trying to something along the following lines:<br><br>> (define-struct posn (x y))<br>> (define my-posn (3 4))<br>> (define (foo posn-instance field)<br> (posn-field posn-instance))<br><br>
where calling <br><br>(foo my-posn "x") <br><br>would dynamically substitute posn-field with posn-x and the function would return 3.<br><br>I don't know what to do with either "x" or posn-field to get this to work. I *think* I'm looking for something like a string->function function, where I could pass in "x" and posn-field would be replaced by <br>
<br>(string->function (string-append "posn-" field)) <br><br>I just don't know if there's something that currently serves that purpose or, if not, how to go about creating that function.<br><br>Thanks, <br>
<br>Todd<br>