Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-28 (20:47)
From: Jon Harrop <jdh30@c...>
Subject: Re: [Caml-list] [ANN] The Missing Library
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 

> 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 


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: