caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alessandro Baretta <alex@baretta.com>
To: John Gerard Malecki <johnm@artisan.com>, Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Wasn't O'Caml a functional language?
Date: Sun, 22 Sep 2002 01:47:27 +0200	[thread overview]
Message-ID: <3D8D050F.9000108@baretta.com> (raw)
In-Reply-To: <15756.65084.40025.869484@spike.artisan.com>



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


  parent reply	other threads:[~2002-09-21 23:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-21 22:47 Alessandro Baretta
     [not found] ` <15756.65084.40025.869484@spike.artisan.com>
2002-09-21 23:47   ` Alessandro Baretta [this message]
2002-09-22  4:23     ` [Caml-list] " Michaël Grünewald
2002-09-23 10:40       ` Pixel
2002-09-24  8:45       ` Alessandro Baretta
     [not found]         ` <15760.15527.648990.807473@hod.void.org>
2002-09-24 13:32           ` Alessandro Baretta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D8D050F.9000108@baretta.com \
    --to=alex@baretta.com \
    --cc=caml-list@inria.fr \
    --cc=johnm@artisan.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).