Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Are map and iter guaranteed to be called in forwards order?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <j.prevost@g...>
Subject: Re: [Caml-list] Are map and iter guaranteed to be called in forwards order?
On Tue, 17 Aug 2004 13:00:53 +0100, Richard Jones <rich@annexia.org> wrote:
> Are the map and iter[1] functions guaranteed to be called in the
> expected order?  In other words will this always produce the same
> result:
  {...}
> [1] From List, for example, but could equally apply to the other
> library modules.

You should also note that both map and iter can sensibly be provided
for data structures that don't have any strong guarantee of order at
all.  For example, a set.  As a rule of thumb, I'd say it's best not
to depend on order in these calls unless (perhaps) you have
implemented the routine yourself, or are using a library that
specifically says what order the calls will be processed.

As Damien says, the documentation for List.map makes no guarantee of
order, while List.iter's documentation says that it is identical to
another construct that does guarantee order.

John.

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