Re: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Andrew Savige
--- Cale Gibbard wrote: Apart from moving to a lookup Map or something, a simple reordering of the arguments allows you to shorten things up a bit: myeval :: String - Int - Int - Int myeval + = (+) myeval - = (-) myeval * = (*) etc. Thanks to all for the excellent suggestions. I'm liking

Re: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Brian Hulley
Andrew Savige wrote: --- Cale Gibbard wrote: Apart from moving to a lookup Map or something, a simple reordering of the arguments allows you to shorten things up a bit: myeval :: String - Int - Int - Int myeval + = (+) myeval - = (-) myeval * = (*) etc. Thanks to all for the excellent

Re: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Brian Hulley
Brian Hulley wrote: eg myeval (+) 1 2 myeval 1 2 (+)-- I *always* seem to make at least one mistake per post ;-) (I originally wrote the code to take the op first, which is the usual Haskell convention so that you can do useful things with (myeval someop) but then I noticed

Re: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Andrew Savige
--- Brian Hulley wrote: def myeval(x, y, op) x.send op, y end This could be done in Haskell by myeval :: a-b-(a - b - c) - c myeval x y op = op x y eg myeval (+) 1 2 Though the following program does indeed work: myeval :: (Int - Int - Int) - Int - Int - Int myeval op x y = op x y

Re: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Sebastian Sylvan
On 1/28/06, Andrew Savige [EMAIL PROTECTED] wrote: --- Brian Hulley wrote: def myeval(x, y, op) x.send op, y end This could be done in Haskell by myeval :: a-b-(a - b - c) - c myeval x y op = op x y eg myeval (+) 1 2 Though the following program does indeed work: myeval

RE: [Haskell-cafe] arr f

2006-01-28 Thread Sven Biedermann
Hello Henrik Ross, Man thanks for your input. I have realised that I should have explained my problem better. So, I try... I want to create a datatype like this: data D a b = DepVoid (a-b) | -- a = () DepSingle (a-b) | -- a = a simple ones

Re[2]: [Haskell-cafe] Evaluating arithmetic expressions at run time

2006-01-28 Thread Bulat Ziganshin
Hello Andrew, Saturday, January 28, 2006, 1:38:08 PM, you wrote: AS def myeval(x, y, op) AS x.send op, y AS end AS I had a feeling this sort of dynamic sending of messages AS to objects at run time was impossible in Haskell, hence AS my question. What I'm still unsure about is why this sort

Re: [Haskell-cafe] arr f

2006-01-28 Thread Chris Kuklewicz
Sven Biedermann wrote: Hello Henrik Ross, Man thanks for your input. I have realised that I should have explained my problem better. So, I try... I want to create a datatype like this: data D a b = DepVoid (a-b) | -- a = () DepSingle (a-b) | -- a = a

Re: [Haskell-cafe] Known Unknowns

2006-01-28 Thread Joel Koerwer
Thanks Chris. I was actually asking about analyzing Core output in general. I'm well aware of the problems we're having with the nbody entry.I'm convinced my list based version can go faster than it is now. That's why I was asking if Don could put together a few notes on how to optimize inner