From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA16532; Tue, 10 Jul 2001 07:33:36 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA16528 for ; Tue, 10 Jul 2001 07:33:35 +0200 (MET DST) Received: from str12.sobor.org (adsl-63-198-183-99.dsl.snfc21.pacbell.net [63.198.183.99]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6A5XXX17436 for ; Tue, 10 Jul 2001 07:33:34 +0200 (MET DST) Received: from quasar.ipa.nw.ru (anza.sobor.org [192.168.123.51]) by str12.sobor.org (Postfix) with ESMTP id 2A78BAC065 for ; Mon, 9 Jul 2001 22:21:16 -0700 (PDT) Message-ID: <3B4A936F.B7610C0D@quasar.ipa.nw.ru> Date: Mon, 09 Jul 2001 22:32:31 -0700 From: "Alexander V. Voinov" Organization: Fear of the Lord is the beginning of wisdom X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: caml Subject: [Caml-list] Iterators and lazy lists Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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): break Certainly, a recursive traversal solution is preferred over a looping one. Thank you in advance Alexander ------------------- 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