[Haskell-beginners] evaluation of expressions [was Re: eval
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Mon Oct 27 23:26:58 EDT 2008
On 2008 Oct 27, at 23:25, Andrew Sackville-West wrote:
> this raises a question for me, being a bit of a schemer. Is there any
> parallel in haskell to the data is code model of the lisp family? For
> example, playing around in scheme with a symbolic differentiator, it
> is trivial to then evaluate the differentiated s-expression at
> arbitrary value by representing the expression, and it's derivative as
> a regular scheme expression.
> Is this something that can be done in haskell? My initial impression
> is no, that you'd have to parse it as an expression and evaluate it as
> you would in regular imperative languages. I'd love to hear otherwise.
You get this in a type-safe form with Template Haskell; you can
operate on expressions at the AST level.
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Beginners