Hi,
>>>>> "Noel" == Noel <[EMAIL PROTECTED]> writes:
>> You can use this function to simulate memoisation. For example:
>>
>> > fib = memoise (0,100) fib' > where > fib' 0 = 0 > fib' 1 = 0 >
>> fib' n = fib (n-1) + fib (n-2)
>>
>> will give a very efficent variation of the fib function.
>>
>>
>> > memoise :: (Ix a) => (a,a) -> (a -> b) -> a -> b > memoise bds
>> f = (!) arr > where arr = array bds [ (t,f t) | t <- range bds ]
>>
is there a simpler way than using arrays? I thought of replacing arrays
by functions maintaining laziness but this would only be useful for
me if a simpler way of memoization is possible.
Cheers
Christoph