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
[Caml-list] Iterators and lazy lists
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-07-10 (05:33)
From: Alexander V. Voinov <avv@q...>
Subject: [Caml-list] Iterators and lazy lists
Hi All,

I didn't fully understand from the docs, what is the preferred way to
generate lazy (e.g., computed on demand) lists in OCaml, like what is
achieved in Python via __getitem__. Should I generate a stream for this,
or define an iterator like in C++?

I'd like to find an analog of the following in Python:

for item in myCustomDict.lazyItems():
	if found(item):

Certainly, a recursive traversal solution is preferred over a looping

Thank you in advance

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr