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 RAA16927; Wed, 28 Apr 2004 17:18:23 +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 RAA16926 for ; Wed, 28 Apr 2004 17:18:21 +0200 (MET DST) Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3SFIKjq027544 for ; Wed, 28 Apr 2004 17:18:20 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id 1F074E00E9; Wed, 28 Apr 2004 10:18:19 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 8D72D5C006; Wed, 28 Apr 2004 10:18:18 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id 455B25C005; Wed, 28 Apr 2004 10:18:18 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id 3C76F33074; Wed, 28 Apr 2004 10:18:18 -0500 (CDT) Date: Wed, 28 Apr 2004 10:18:18 -0500 From: John Goerzen To: skaller Cc: Jon Harrop , caml-list Subject: Re: [Caml-list] [ANN] The Missing Library Message-ID: <20040428151818.GC1310@excelhustler.com> References: <200404280613.19547.jdh30@cam.ac.uk> <1083141467.9537.845.camel@pelican.wigram> <200404281018.14913.jdh30@cam.ac.uk> <1083151482.9537.904.camel@pelican.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1083151482.9537.904.camel@pelican.wigram> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanned-By: clamscan at chatterbox.elmer.internal.excelhustler.com X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 2004:99 endline:01 endline:01 incr:01 callback:01 callback:01 ocaml:01 ocaml:01 complex:03 wrote:03 wrote:03 library:03 object:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Apr 28, 2004 at 09:24:43PM +1000, skaller wrote: > On Wed, 2004-04-28 at 19:18, Jon Harrop wrote: > Control inversion. In Ocaml you can write: > > List.iter (fun x -> print_endline x) ["Hello"; "World"];; [ snip ] > while ( p != e) do print_endline (get p); incr p done; [ snip ] > > The List.iter style HOF is very limited in utility > in a functional language: there is no state. > In Ocaml you can add state of course. But it's a mess. I don't find it all that problematic. For one, you can just maintain the state in the scope above the callback. The callback has access to all those variables, of course. And you could always just pass whatever object or record you like in to the callback. Neither is all that complex to me. ------------------- 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