From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA31628; Fri, 9 Nov 2001 01:29:13 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA31444 for ; Fri, 9 Nov 2001 01:29:11 +0100 (MET) Received: from leia.mandrakesoft.com (office.mandrakesoft.com [195.68.114.34]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id fA90TBv24063 for ; Fri, 9 Nov 2001 01:29:11 +0100 (MET) Received: by leia.mandrakesoft.com (Postfix, from userid 505) id 8AA7E578A; Fri, 9 Nov 2001 01:26:46 +0100 (CET) To: "Diego Olivier Fernandez Pons" Cc: "Caml" Subject: Re: [Caml-list] Pattern matching References: <009f01c167fe$ebf5e780$2770f2c3@Utilisateur> From: Pixel Date: 09 Nov 2001 01:26:46 +0100 In-Reply-To: <009f01c167fe$ebf5e780$2770f2c3@Utilisateur> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "Diego Olivier Fernandez Pons" writes: [...] > let couples = function n -> > let rec couplesCPS = function > | (n,_) -> [ ] vs > let couples = function n -> > let rec couplesCPS = function > | (i,_) when (i = n) -> [ ] the problem is an expressivity one. Something like (function A(e) -> e | _ -> ...) become dependent on the context: is there a variable "e" in the surrounding context. This is not good. One could add some sugar allowing: > let couples = function n -> > let rec couplesCPS = function > | (@@n,_) -> [ ] where @@n force the scope of n to be non-local. But too much sugar makes the language harder to learn :) [...] > let egalite = function > | (x,x) -> true > | (x,y) -> false > ;; > # This variable is bound several times in this matching i wonder why this one is not allowed since it can't have any other meaning than the one it has in prolog. What's the reason for not having it rewritten to: > let egalite = function > | (x,x') when x=x' -> true > | (x,y) -> false maybe you're right than the kind of equality (= vs ==) may be the problem... ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr