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 BAA14987; Sun, 22 Sep 2002 01:38:17 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA14444 for ; Sun, 22 Sep 2002 01:38:16 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a121.tin.it [62.211.4.121]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8LNc2D05738 for ; Sun, 22 Sep 2002 01:38:11 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id AA0B42724C; Sun, 22 Sep 2002 01:47:27 +0200 (CEST) Message-ID: <3D8D050F.9000108@baretta.com> Date: Sun, 22 Sep 2002 01:47:27 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: John Gerard Malecki , Ocaml Subject: Re: [Caml-list] Wasn't O'Caml a functional language? References: <3D8CF6F8.2050904@baretta.com> <15756.65084.40025.869484@spike.artisan.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Gerard Malecki wrote: > I don't see any side effects in Queue.iter? Here is the code Neither do I. I probably just need to retire to buddhist monastery in Nepal. Here is the quote from the manual: * iter f q applies f in turn to all elements of q, from the * least recently entered to the most recently entered. The > * queue itself is unchanged. > Can you better describe the problem? (Maybe what you're saying is > that if f is side-effecting then iter acts perversely.) I sure can: it's just a vast degenerative neurological disease. Sorry, my mistake, the side-effect is not in Queue.iter. It is in Queue.transfer, which I happen to use somewhere down the road in the control flux of the function I apply to the Queue. The fact that the main data structure in my program has type "data_elem Queue.t Queue.t Queue.t" adds to the confusion. The iterator giving me trouble is the one acting at the central Queue.t level, and the unwanted side_effects are situated at the lower level of nesting (data_elem Queue.t). Anyway, my main claim, although misdirected, in not entirely faulty. Queue.transfer can be thought of as analogous to List.append. When I write let list = list1 @ list2 I do not expect side-effects on list1 or list2. My most sincere apologies for my previous encephalitic post. Alex ------------------- 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