Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
As-binding #-types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1996-09-13 (09:36)
From: Francois Rouaix <Francois.Rouaix@i...>
Subject: Re: As-binding #-types/Evaluation order & State

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 =
    let h = Queue.take q in 
       h::list_of_queue q
    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 ?

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