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 TAA08373; Tue, 18 Nov 2003 19:56:15 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA07940 for ; Tue, 18 Nov 2003 19:56:14 +0100 (MET) Received: from mail3.tpgi.com.au (mail.tpgi.com.au [203.12.160.59]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hAIIuC116810 for ; Tue, 18 Nov 2003 19:56:12 +0100 (MET) Received: from 203-219-235-3-syd-ts26-2600.tpgi.com.au (203-219-235-3-syd-ts26-2600.tpgi.com.au [203.219.235.3]) by mail3.tpgi.com.au (8.11.6/8.11.6) with ESMTP id hAIIu5o17961; Wed, 19 Nov 2003 05:56:05 +1100 Subject: Re: [Caml-list] GC and file descriptors From: skaller Reply-To: skaller@ozemail.com.au To: John J Lee Cc: Caml Mailing List In-Reply-To: References: <1069092899.17437.58.camel@pelican> <20031118120517.GA881@exomi.com> <1069168782.18363.90.camel@pelican> Content-Type: text/plain Message-Id: <1069178132.18363.213.camel@pelican> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 19 Nov 2003 04:55:32 +1100 Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 ozemail:01 python:01 closures:01 beast:01 retval:99 nesting:01 ocaml:01 ocaml:01 05,:01 descriptors:01 closure:01 nov:01 match:02 iterators:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 2003-11-19 at 05:10, John J Lee wrote: > On Tue, 19 Nov 2003, skaller wrote: > > On Tue, 2003-11-18 at 23:05, Ville-Pertti Keinonen wrote: > [...] > > You haven't seen Python 2.2? Its a genuine functional > > programming language now, with full lexical scoping, > > closures, and even some advanced concepts like > > iterators which cannot be programmed in Ocaml. > [...] > > Don't you mean generators? Probably. You can write a function and yield a value in the middle.. and then later continue on from the yield point. The main use of such a beast is to implement container iterators using the closure state to maintain the position in the container. You can't do that (directly) in Ocaml. Of course you can write: let make_f () = let state = ref 0 in let f x = match !state with | 0 -> .... state := 6; retval1 | 1 -> ... in f but this is a real mess when you start nesting things... ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners