Re: [Haskell] How to make sure that a function is evaluated only once?

2006-12-22 Thread Axel Jantsch
Thanks to all who replied. I still haven't figured out a solution. I thought about memoizing the result, as several of you have suggested, but I am scared by the huge argument space. Lemmih [EMAIL PROTECTED] wrote: Do you have a minimal test case showing the undesirable behaviour? gf

Re: [Haskell] How to make sure that a function is evaluated only once?

2006-12-22 Thread Lemmih
On 12/22/06, Axel Jantsch [EMAIL PROTECTED] wrote: Thanks to all who replied. I still haven't figured out a solution. I thought about memoizing the result, as several of you have suggested, but I am scared by the huge argument space. Lemmih [EMAIL PROTECTED] wrote: Do you have a minimal test

Re: [Haskell] How to make sure that a function is evaluated only once?

2006-12-22 Thread Dan Weston
I thought a let expression was just as lazy as a where clause. Is this not true? Dan Lemmih wrote: On 12/22/06, Axel Jantsch [EMAIL PROTECTED] wrote: Thanks to all who replied. I still haven't figured out a solution. I thought about memoizing the result, as several of you have suggested,

[Haskell] How to make sure that a function is evaluated only once?

2006-12-21 Thread Axel Jantsch
Hello, I have a function with type f :: Int - Int - Int - Int - Int - NRup - NRdown and I want to make sure it is evaluated only once for the same set of arguments but I observe that it is always evaluated several times. f is implemented in C and called via the FFI. The C function may or may

Re: [Haskell] How to make sure that a function is evaluated only once?

2006-12-21 Thread Lemmih
On 12/21/06, Axel Jantsch [EMAIL PROTECTED] wrote: Hello, I have a function with type f :: Int - Int - Int - Int - Int - NRup - NRdown and I want to make sure it is evaluated only once for the same set of arguments but I observe that it is always evaluated several times. f is implemented in

Re: [Haskell] How to make sure that a function is evaluated only once?

2006-12-21 Thread Samuel Bronson
On 12/21/06, Axel Jantsch [EMAIL PROTECTED] wrote: I have a function with type f :: Int - Int - Int - Int - Int - NRup - NRdown and I want to make sure it is evaluated only once for the same set of arguments but I observe that it is always evaluated several times. Maybe you want to memoize