English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
possible way to improve "lazy"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-21 (01:06)
From: Jeffrey Loren Shaw <shawjef3@m...>
Subject: Re: [Caml-list] possible way to improve "lazy"

Thanks for that link! It looks like this has been discussed at some length. 

Well hm, I guess consider my post a request for renewed effort on this 
front. Lazy evaluation can be very useful, and since caml already supports 
it, it'd be nice if it were easier to use. 

Zheng Li,
Yes that's exactly what I'm asking for! It'd be really cool to have in caml 

type 'a t = 'a * 'a t Lazy.t;; 

This will work for infinite lists, but there is no empty list, so it's not 
quite a proper lazy list. 

And streams aren't right either, because they are destructive. If you ask 
for the 3rd element on a lazy list, you can still ask for the 1st and 2nd 
elements, whereas streams are unable to recover the previous values. This 
has its applications but it's not the same as a list. 

Thanks for the posts! I'll keep plugging away to try and get my 
combinatorial parser to work perfectly lazy. I'm close but I'm having 
trouble with sequencing.