
Henning Thielemann a écrit :
On Thu, 24 Mar 2005, Pierre Barbier de Reuille wrote:
My question is: is there some (simple?) rule/criteria to ensure leazy evaluation will be efficient ?
One rule of thumb is: If your implementation works for infinite lists then it will also be quite efficient for finite lists. Do you mean criteria of this kind?
I think you mean doing something like : take 10 (fct infiniteList) .. this answers my first question: how to be sure it uses leazy evaluation :). But now the second (hardest ?) question: if the answer is "no", how can I detect where leazy evaluation fails ? Is there first approximation rules, at least pointing where leazy evaluation is likely to fail ? (like avoiding functions like length, minimum, ..., some structure ...) Pierre -- Pierre Barbier de Reuille INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde 34398 MONTPELLIER CEDEX 5, France tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68