From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id TAA00993 for caml-redistribution; Wed, 13 Sep 1995 19:18:28 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id SAA00662 for ; Wed, 13 Sep 1995 18:51:49 +0200 Received: from waldorf.cs.chalmers.se (raffalli@waldorf.cs.chalmers.se [129.16.226.10]) by nez-perce.inria.fr (8.6.10/8.6.9) with ESMTP id SAA00579 for ; Wed, 13 Sep 1995 18:51:47 +0200 Received: (from raffalli@localhost) by waldorf.cs.chalmers.se (8.6.11/8.6.9) id SAA24277; Wed, 13 Sep 1995 18:51:38 +0200 Date: Wed, 13 Sep 1995 18:51:38 +0200 Message-Id: <199509131651.SAA24277@waldorf.cs.chalmers.se> From: Christophe Raffalli To: Pierre.Weis@inria.fr CC: caml-list@pauillac.inria.fr In-reply-to: <199509131511.RAA29007@pauillac.inria.fr> (message from Pierre Weis on Wed, 13 Sep 1995 17:11:31 +0200 (MET DST)) Subject: Re: Suggestions Sender: weis > Why don't you use the ``when'' clauses of Caml Light 0.7? > > let f x = > match read x with > C (x1, x2) when > (match read x1, read x2 with > C _,C _ -> true > | _ -> false) -> > ...code2... > | _ -> ...code1... >;; This is ok in this example, but the problem is that "when" is not a binder ! So if I want to write let f x = match read x with C (x1, x2) when (match read x1, read x2 with C (x3,x4),C (x5,x6) -> true | _ -> false) -> ...code2... | _ -> ...code1... ;; x3,x4,x5,x6 are not bound in ...code2... too bad ! With the "where match" match guard it will work and look nicer ! let f x = match read x with C (x1, x2) where match read x1, read x2 with C (x3,x4),C (x5,x6) -> ....code2.... | _ -> ...code1... ;; The "where match" is in fact strictly more general than the when: pat when exp -> is equivalent to pat where match exp with true -> but the when is weaker because it does not bind any variable. Christophe Raffalli.