On Mon, 2012-09-17 at 15:49 +0200, Timon Gehr wrote: […] > In effect, everything is a non-null reference to mutable, but as > mutation is constrained rather specifically, it is possible to reason > about the behaviour of Haskell programs on a higher level of > abstraction. > > > let fib n = if n<2 then n else fib (n-1) + fib (n-2) > > let x = fib 30 > > let y = x > > let z = x > > y > (delay) > 832040 > > z > (no delay) > 832040
This is just an artefact of Haskell being a lazy language: x is only evaluated on demand; the lack of delay is due to the fact the value is already computed. Hopefully no-one actually uses that expression for calculating Fibonacci series for real. Are you sure the references are to mutable? I had understood Haskell to be a single assignment to immutable values language. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part