Alexander Solla comments my comment :


    Alright, my turn. I never wanted to write non-terminating programs
    (what for?),


Daemons/servers/console interfaces/streaming clients?
Come on, not THIS kind of non-termination. This has little to do with strictness/laziness, I think. Endless loops can be coded in various ways...

    I see ONE usage of laziness: the possibility to write co-recursive
    equations, which become algorithms


What about "infinite" lists? There is no need for mutually recursive functions to see the usefulness of a list which never ends, and is computed to the length that your algorithm /acutally/ requires.

This is almost EXACTLY what I meant. When I say "co-recursive", I do not mean "mutually recursive". Rather the extrapolating recursion, not necessarily "terminating" (lacking the base clause) but finitely progressing, such as the standard definition of the stream of integers, used to scare the beginners...

ints = 1 : zipWith (+)  (fix (1:)) ints
  where  fix f = f (fix f)

Thanks.

Jerzy Karczmarczuk

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

Reply via email to