[Haskell-cafe] Re: A bit of a shock - Memoizing functions

GüŸnther Schmidt gue.schmidt at web.de
Fri Mar 27 16:58:02 EDT 2009


Hi Bulat,

that is so cool!

Günther

Bulat Ziganshin schrieb:
> Hello Gü?nther,
> 
> Friday, March 27, 2009, 11:30:41 PM, you wrote:
> 
>> Some of the memoizing functions, they actually "remember" stuff
>> *between* calls?
> 
> what i've seen in haskell - functions relying on lazy datastructures
> that ensure computation on first usage so this looks exactly like as
> memoizing:
> 
> power 2 n | n>=0 && n<100 = powersOfTwo!n
> power x y = x^y
> 
> powersOfTwo = array (0,99) [2^n | n <- [0..99] ]
> 
> 
> it's almost exact definition from ghc Prelude
> 
> 
> 




More information about the Haskell-Cafe mailing list