[Haskell-cafe] A bit of a shock - Memoizing functions
Bulat Ziganshin
bulat.ziganshin at gmail.com
Fri Mar 27 16:48:48 EDT 2009
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
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list