English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 (08:38)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] [ANN] The Missing Library
On Wed, 2004-04-28 at 15:13, Jon Harrop wrote:
> On Wednesday 28 April 2004 5:31 am, Brian Hurt wrote:
> > It's been too long since I've used the STL- what data structures and
> > algorithms does it provide?
> The main thing is that it is iterator-centric, 

> This is quite useful for 1D containers, which the STL provides (list, slist, 
> vector, deque), but it doesn't lend itself well to many useful containers 
> (trees, matrices, higher-dimensional arrays) which exhibit more interesting 
> connectivities than a bidirectional iterator can represent and which do not 
> exhibit a clear notion of "sub".

That isn't true. Computers can only do things in sequence
(well, ignoring fledgling parallelism). 

Using iterators, your higher dimensional problem is factored
into two halves: the sequential algorithm, and the sequence

There aint no other way (short of parallelism). 
Iterators simply enforce a control inversion boundary:
the sequence generator is callback driven, the algorithm
its driver: iterators mediate the control relation.

Exactly how you define your iterator is up to you,
but clearly the specification factors your problem
as I described.

Obvious examples include say 'depth first traversal'
of a tree. However you process a tree, it can be
done with an iterator.

Perhaps it is necessary to generalise the concept of
'next': in STL you can +/- int for random iterators,
but there is no reason next can't be generalised to
take an arbitrary motion indicator.

Clearly that reflects on the general structure of the
container, so there are higher classes of iterators
than just forward and random. The key concept is
a 'current location' and 'movement instruction'.

Sounds like Logo got it right with Turtle graphics :D

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