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 WAA23308; Wed, 28 Apr 2004 22:47:10 +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 WAA23295 for ; Wed, 28 Apr 2004 22:47:09 +0200 (MET DST) Received: from ptb-relay03.plus.net (ptb-relay03.plus.net [212.159.14.214]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3SKl8YM028257 for ; Wed, 28 Apr 2004 22:47:08 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay03.plus.net with esmtp (Exim) id 1BIvxT-000Gtc-4y for caml-list@inria.fr; Wed, 28 Apr 2004 20:47:07 +0000 From: Jon Harrop Organization: University of Cambridge To: caml-list@inria.fr Subject: Re: [Caml-list] [ANN] The Missing Library Date: Wed, 28 Apr 2004 21:43:01 +0100 User-Agent: KMail/1.5.4 References: <200404280613.19547.jdh30@cam.ac.uk> <20040428151521.GB1310@excelhustler.com> In-Reply-To: <20040428151521.GB1310@excelhustler.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404282143.01794.jdh30@cam.ac.uk> X-Miltered: at concorde 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 iterator:01 iterator:01 passing:01 truncate:01 justified:01 work-around:01 higher-order:01 imho:01 approaches:01 complexity:02 complexity:02 match:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wednesday 28 April 2004 4:15 pm, John Goerzen wrote: > On Wed, Apr 28, 2004 at 06:13:19AM +0100, Jon Harrop wrote: > > The main thing is that it is iterator-centric, so you pass iterators > > around instead of containers. For example, to represent a subarray > > without having to copy it. These iterators are classified according to > > their abilities (e.g. > > That's not necessarily a good thing. For one, it leads to complexity. Absolutely, incidental complexity at that. > What if you modify the parent array? Would the iterator show the new or > original values? New values. The iterator presents a view of the original data. For example, you might have a function which normalises a vector which is passed to it as a pair of iterators. You could then use this function to normalise a column vector in a matrix by passing it "stride" iterators which transparently return a single element from each row (i.e. a column) instead of adjacent elements. > What if you truncate the parent? Would the iterator > produce fewer results than it originally promised? No, your program would crash. Possibly corrupting the file system. ;-) > And of course, you > can't so nicely use iterators in match clauses like you can lists. Yes, exactly. I think the "control driven" STL propaganda is just marketing hype. IMHO, such approaches to algorithmics are only justified as an inadequate work-around for the absence of higher-order functions. Look for "bind2nd" in the STL, for example. Cheers, Jon. ------------------- 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