<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Yes, you can do it with a struct with the property <span class="Apple-style-span" style="font-family: 'Courier New'; ">prop:procedure</span>. </div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'">#lang racket</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(require rackunit)</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(struct my-proc (proc str)</font></div><div><font class="Apple-style-span" face="'Courier New'"> #:property prop:procedure (struct-field-index proc))</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(define f</font></div><div><font class="Apple-style-span" face="'Courier New'"> (my-proc (lambda (x) (+ x 1))</font></div><div><font class="Apple-style-span" face="'Courier New'"> "(lambda (x) (+ x 1))"))</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(check-true (procedure? f))</font></div><div><font class="Apple-style-span" face="'Courier New'">(check-equal? (f 1) 2)</font></div><div><font class="Apple-style-span" face="'Courier New'">(check-equal? (my-proc-str f)</font></div><div><font class="Apple-style-span" face="'Courier New'"> "(lambda (x) (+ x 1))")</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(define-syntax-rule (my-lambda args body ...)</font></div><div><font class="Apple-style-span" face="'Courier New'"> (my-proc (lambda args body ...)</font></div><div><font class="Apple-style-span" face="'Courier New'"> (substring (~v '(lambda args body ...)) 1)))</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(define f2</font></div><div><font class="Apple-style-span" face="'Courier New'"> (my-lambda (x) (+ x 1)))</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">(check-true (procedure? f2))</font></div><div><font class="Apple-style-span" face="'Courier New'">(check-equal? (f2 1) 2)</font></div><div><font class="Apple-style-span" face="'Courier New'">(check-equal? (my-proc-str f2)</font></div><div><font class="Apple-style-span" face="'Courier New'"> "(lambda (x) (+ x 1))")</font></div><div><br></div></div><br><div><div>On Dec 29, 2013, at 10:45 PM, Alegria Baquero wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div>Hello,<br><br></div>is there any way to transform a function's body to a string such as "(lambda(x)...)"?<br><br></div>Thanks<br><br>Alegria<br></div> ____________________<br> Racket Users list:<br> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br></blockquote></div><br></body></html>