Luc Maranget a écrit : >> You mean that if I write (I use OCaml syntax) >> >> match p, q with >> | (true, true) -> A >> | _ -> B >> >> Haskell will first check if (p is evaluated and false) or (q is evaluated and false) >> and then, if it is not the case will evaluate p, and finally if p is true it will evaluate q ? >> >> > > Haskell has left-to-right semantics for PM. Basically this is expressed > by PM compilation. > And this is not optimal (I was answering the sentence "Haskell does it right"). In fact, there is no optimal way of doing pattern matching in lazy languages (with deep pattern) because the language can not decide what is best to evaluate. Certainly left to right is a reasonnable choice, but letting the programmer choose (or even forcing him to choose has in OCaml) is a good choice (I think better). -- Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------