Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] [ANN] The Missing Library
On Wed, 2004-04-28 at 18:42, Martin Berger wrote:
> >>I'm wondering what concepts Ocaml can't express/enforce? 
> > 
> > 
> > Iterators. 
> 
> it's been a long time since i used C++, but i seem to remember that
> complexity guarantees are also part of the STL specification: something
> like "to go from element x to element x+n" using a linear iterator takes
> at most O(n) steps".

Yes, that's true of C++ Standard Library iterators.
However, in the more abstract context, I'd say that important
idea is a design guide, not a requirement.

Clearly a single fixed iteration technique for a given
data structure is not enough for all problems, any more than
a fixed set of algorithms.

In particular if you consider more general tree navigation,
you can certainly do anything with iterators, but clearly
the movement instructions may have to be generalised.
You may need 'goto_parent' as well as 'goto_next_child' 
for example..

The key thing characterising an iterator appears to be
that it is some state representing a position in a data 
structure.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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