
On Nov 28, 2009, at 12:01 , Ozgur Akgun wrote:
Answering my own question, one can achieve the goal via doing a lookup, if the number of possible parameters is limited. eg. assume add is a function which can only take Int's from [0..9].
Interestingly, my situation is exactly like this. I think I'll implement such a lookup.
The question is still open though, if somebody has some magic to extract the prameter from an applied function...
You can't, because it's a chunk of machine code, not an AST that can be walked to pull out parameters. The solution is to convert it to the latter form (in the simplest case, a tuple is good enough; if you need something more complicated you'll have to define an actual AST datatype). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH