[Haskell-cafe] New (simple) Lazy Evaluation tutorial

2007-01-18 Thread Andrew Wagner

Hi all,

An interesting question came up in #haskell the other day, and I took
the resulting discussion and wrapped it up into a simple tutorial for
the wiki. Since I'm quite a newbie to haskell myself, I'd appreciate
any double-checking of my logic and, of course, any other
comments/suggestions. Thanks to Cale for his efforts on this problem,
and to the original asker, whose name I can't recall.

http://www.haskell.org/haskellwiki/Haskell/Lazy_Evaluation
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] New (simple) Lazy Evaluation tutorial

2007-01-18 Thread Seth Gordon
Andrew Wagner wrote:
 Hi all,
 
 An interesting question came up in #haskell the other day, and I took
 the resulting discussion and wrapped it up into a simple tutorial for
 the wiki. Since I'm quite a newbie to haskell myself, I'd appreciate
 any double-checking of my logic and, of course, any other
 comments/suggestions. Thanks to Cale for his efforts on this problem,
 and to the original asker, whose name I can't recall.
 
 http://www.haskell.org/haskellwiki/Haskell/Lazy_Evaluation

Rather than use the Fibonacci series as an example, why not something
like this...?

contains :: String - String - Bool
contains _  = False
contains  _ = True
contains (x:xs) (y:ys) =
((x == y  contains xs ys) || contains (x:xs) ys)

infiniteBanana :: String
infiniteBanana = banana ++ infiniteBanana

contains na infiniteBanana

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe