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 QAA29023; Tue, 17 Aug 2004 16:27:02 +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 QAA26907 for ; Tue, 17 Aug 2004 16:27:01 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7HEQxRM026723 for ; Tue, 17 Aug 2004 16:27:00 +0200 Received: by mproxy.gmail.com with SMTP id 76so126266rnk for ; Tue, 17 Aug 2004 07:26:59 -0700 (PDT) Received: by 10.38.102.11 with SMTP id z11mr52884rnb; Tue, 17 Aug 2004 07:26:59 -0700 (PDT) Message-ID: Date: Tue, 17 Aug 2004 10:26:59 -0400 From: John Prevost Reply-To: John Prevost To: Caml Mailing List Subject: Re: [Caml-list] Are map and iter guaranteed to be called in forwards order? In-Reply-To: <20040817120053.GA9749@annexia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20040817120053.GA9749@annexia.org> X-Miltered: at concorde with ID 412215B3.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; prevost:01 prevost:01 caml-list:01 2004:99 sensibly:01 implemented:01 damien:01 modules:02 identical:03 wrote:03 library:03 library:03 iter:03 iter:03 data:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 17 Aug 2004 13:00:53 +0100, Richard Jones 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