[Haskell-beginners] evaluation of expressions [was Re: eval command?]

Andrew Sackville-West andrew at swclan.homelinux.org
Wed Oct 29 10:02:46 EDT 2008


On Wed, Oct 29, 2008 at 09:27:32AM +0100, Tillmann Rendel wrote:
> Andrew Sackville-West schrieb:
>> 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? 
>
> No.
>
>> 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.
>
> I don't see how "code is data" is connected to imperative vs. purely  
> functional. After all, lisp & co. are not purely functional, but feature  
> "code is data". Another well-known symbolic language, which allows to  
> treat code as data and vice versa, is prolog.

I didn't mean to connect the concept to imperative vs. functional. 

>
> Since Haskell features algebraic data types, and a reasonable flexible  
> syntax, you do not need to do any parsing. Instead, you can write down  
> the AST of the embedded language directly as part of your Haskell  
> program. But you have to write an evaluator. With pattern matching, that  
> is often very easy, though.

looks like I'm off to read about Template Haskell.

thanks to all.

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20081029/7cc44d4a/attachment.bin


More information about the Beginners mailing list