<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite"><div><br>You might want polymorphism here, or variable arity polymorphism, but<br>I'd have to be sure of what you were trying to do.</div></blockquote><br></div><div><br></div><div>I'm just looking for a way to represent functions - so I have this 'Fun' type storing the function's name, return type and arguments (up till now I have a number type and a string type only, represented by symbols N and S), and the action it's supposed to execute, which would be the scheme function if an appropriate one exists or a lambda expression otherwise.</div><div>Then I really just want to extract the code from this representation and apply it to some given object... just like in the made-up example I posted.</div><div><br></div><div>And this should work for every kind of function, so yes it should be variable arity, but also variable return types - just some general possibility to apply "anything at all" to anything - like if I had</div><div><br></div><div><span class="Apple-style-span" style="font-family: fixed-width, monospace; font-size: 10px; "><p>(define-struct: Fun ((name : Symbol) (proc : Procedure) (args : (Listof Symbol)) (ret : Symbol)))&nbsp;</p><p>(define f1 (make-Fun 'plus + '(N N) 'N))&nbsp;<br>((Fun-proc f1) 1 2)&nbsp;</p><div><br></div><div>(define f2 (make-Fun 'substr substring '(S &nbsp;N N) 'S))&nbsp;</div></span></div><div><span class="Apple-style-span" style="font-family: fixed-width, monospace; font-size: 10px; ">((Fun-proc f2) "astring" 2 4)&nbsp;</span></div><div><font class="Apple-style-span" face="fixed-width, monospace" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica, monospace"><br></font></div><div><font class="Apple-style-span" face="Helvetica, monospace"><span class="Apple-style-span" style="font-family: Helvetica; ">and it worked...</span></font></div><div>I don't know if this sounds silly, but I wouldn't know how I could represent functions in another way.</div><div><br></div><div>Ciao,</div><div>Sigrid</div><div><br></div></body></html>