--- 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
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
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
--- 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
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
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
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
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
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