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 UAA26982; Fri, 5 Jul 2002 20:18:33 +0200 (MET DST) 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 UAA27008 for ; Fri, 5 Jul 2002 20:18:32 +0200 (MET DST) Received: from relay.pair.com (relay1.pair.com [209.68.1.20]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id g65IIVf06765 for ; Fri, 5 Jul 2002 20:18:31 +0200 (MET DST) Received: (qmail 44632 invoked from network); 5 Jul 2002 18:18:28 -0000 Received: from adsl-host-sf-228.apexworld.net (HELO checkerlap.d6.com) (66.114.212.228) by relay1.pair.com with SMTP; 5 Jul 2002 18:18:28 -0000 X-pair-Authenticated: 66.114.212.228 Message-Id: <4.3.2.7.2.20020705094337.0392bd20@mail.d6.com> X-Sender: checker@mail.d6.com X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Fri, 05 Jul 2002 10:59:28 -0700 To: Xavier Leroy From: Chris Hecker Subject: Re: [Caml-list] Re: generic programming Cc: Francois Pottier , caml-list@inria.fr In-Reply-To: <20020705155405.A20462@pauillac.inria.fr> References: <4.3.2.7.2.20020705024112.038909f0@mail.d6.com> <20020705104249.B14853@pauillac.inria.fr> <200207030246.WAA28665@dewberry.cc.columbia.edu> <4.3.2.7.2.20020703102610.0248b280@mail.d6.com> <3D246739.4030204@ozemail.com.au> <20020705104249.B14853@pauillac.inria.fr> <20020705112551.B16273@pauillac.inria.fr> <4.3.2.7.2.20020705024112.038909f0@mail.d6.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >All you said is very reasonable, but I think you're generalizing the >discussion (especially with the GUI examples) beyond what I had in >mind, i.e. iteration over in-memory data structures. Right, I just think they're the same issue, just at different levels of=20 detail (and impact on code). I definitely think "map" et al. are useful,=20 and I didn't mean to imply otherwise. I mean, I am trying to learn a=20 functional language after all, so clearly I dig it. :) My main point was not about iterators specifically, it was about the flow=20 control issue that got brought up when someone said "you don't need=20 iterators because you have callbacks". I was saying that the existence of= =20 a callback interface isn't always a good substitute for an imperative one. > The language provides full imperative power, and it's easy to write >imperative iterators over concrete data structure (like Fran=E7ois >showed). So, what more would you like? I need to look at Francois' solution, so I'm not sure yet. I'm actually=20 not running into a problem right now with this anyway, so it's academic for= =20 me at this point, it was just something I've been wondering about since I=20 started learning caml and was mentally comparing it to C++'s templates. I= =20 haven't thought about the issues thoroughly, but maybe John Max Skaller can= =20 comment on whether Francois' iterators are "good enough" for what he was=20 trying to write. >My comment is more along the need of "I don't see when you'd ever need >to do that, but please enlighten me". The hashtable example wasn't mine, so I don't know about that. There's=20 also a canonical two-different-shaped-trees example, I think, but I don't=20 know much about that either. I run into this all over the place writing=20 games, however. The GUI thing was one example of a related thing that's=20 higher level, but to constrain it to datastructure iteration, often times=20 you'll want to do part of an iteration, and then save the state, and the do= =20 the next part. So, you'll iterate over some of your AIs this frame, and=20 some next frame, to manage your CPU utilization and amortize over multiple= =20 frames. I don't know how you'd do that with a "functional iter" (isn't=20 that a contradiction? :), although I'm sure someone will come up with=20 something insane using continuations and whatnot to prove me wrong. Chris ------------------- 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