Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Francois Rouaix <Francois.Rouaix@inria.fr>
To: christo@nextsolution.co.jp (Frank Christoph)
Cc: caml-list@pauillac.inria.fr
Subject: Re: As-binding #-types/Evaluation order & State
Date: Fri, 13 Sep 1996 11:24:03 +0200	[thread overview]
Message-ID: <199609130924.LAA04829@madiran.inria.fr> (raw)
In-Reply-To: Your message of "Thu, 12 Sep 1996 21:13:01 +0900." <9609121213.AA00935@sparc3.nextsolution.co.jp>


Dear Frank,

about the evaluation order question:

> [this is bogus because of right-to-left order]
>  #let rec list_of_queue q =
>  #  try Queue.take q :: list_of_queue q with Queue.Empty -> []

I would have written

let rec list_of_queue q =
  try
    let h = Queue.take q in 
       h::list_of_queue q
  with
    Queue.Empty -> []

in this case, which seems pretty natural.

In general, if I have a doubt about consequences of evaluation order on the
state, say for:
   ef e1 e2 en

I'd write (assuming I want left-to-right order of course)
   let f = ef  in
   let x1 = e1 in
   ...
   let xn = en in
     ef x1 ... xn

Or did I miss something ?


-- 
Francois.Rouaix@inria.fr                   Projet Cristal - INRIA Rocquencourt
Programming is dreadfully impermanent;  it's more like performance art
than literature -- Bruce Sterling (dixit Wired)







      reply	other threads:[~1996-09-13  9:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-12  9:53 As-binding #-types Frank Christoph
1996-09-12 11:56 ` Jerome Vouillon
1996-09-12 12:13 ` As-binding #-types/Evaluation order & State Frank Christoph
1996-09-13  9:24   ` Francois Rouaix [this message]

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=199609130924.LAA04829@madiran.inria.fr \
    --to=francois.rouaix@inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=christo@nextsolution.co.jp \
    /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