From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5176DBC69 for ; Thu, 9 Nov 2006 00:55:42 +0100 (CET) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.204]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kA8Ntfki012198 for ; Thu, 9 Nov 2006 00:55:41 +0100 Received: by nz-out-0102.google.com with SMTP id l8so13524nzf for ; Wed, 08 Nov 2006 15:55:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dPs7PCNU5qGYkQdtT7LFLO55RuJNkxCwkU3vb5rNzCG7Q/xhF8On7DjYR1gxc3g+8D97e0Vyeq+DUJgA0ZQ7ePcYty/CthLeWi3I3SdEqcJ+fU8Ogy1ckgbFMR5csEGCs/psZD2+wPBVkiZYklyV3GmOuf5SNGAxeFjeNLKw6DI= Received: by 10.35.98.6 with SMTP id a6mr381172pym.1163030136502; Wed, 08 Nov 2006 15:55:36 -0800 (PST) Received: by 10.35.26.7 with HTTP; Wed, 8 Nov 2006 15:55:36 -0800 (PST) Message-ID: <4a708d20611081555i1f860911rfb7a29d31a34ce7a@mail.gmail.com> Date: Thu, 9 Nov 2006 00:55:36 +0100 From: "Lukasz Stafiniak" To: "Serge Aleynikov" Subject: Re: [Caml-list] parameterized pattern Cc: caml-list@inria.fr In-Reply-To: <454FA5F8.5030106@hq.idt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <454FA5F8.5030106@hq.idt.net> X-j-chkmail-Score: MSGID : 45526E7D.000 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 45526E7D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lukasz:01 ad-hoc:01 polymorphism:01 g'caml:01 u-tokyo:01 furuse:01 gcaml:01 g'caml:01 node:01 1278:01 ocaml:01 ocaml:01 oleg:01 oleg:01 ocaml's:01 You can do this kind of ad-hoc polymorphism with with G'Caml: http://web.yl.is.s.u-tokyo.ac.jp/~furuse/gcaml/ BTW, I think that G'Caml deserves more attention on this list (see http://lambda-the-ultimate.org/node/1278). (I've even thought that it is still a patch to OCaml 2.0, but it seems to be up-to-date now.) You can check also a related attempt in Meta OCaml, by Oleg Kiselyov: http://pobox.com/~oleg/ftp/ML/gprint/ (search the archives for "Generic print function"). On 11/6/06, Serge Aleynikov wrote: > Hi, > > The section 6.6 of OCaml's manual introduces a notion of "Parenthesized > patterns". > > I couldn't find any examples on how to use this feature, and brute-force > approach doesn't work: > > # match 1.0 with > (y : float) -> print_float y > | (s : string) -> print_string s;; > This pattern matches values of type string > but is here used to match values of type float > # > > Could anyone point at a suitable resource? > > Thanks. > > Serge > > -- > Serge Aleynikov > Routing R&D, IDT Telecom > Tel: +1 (973) 438-3436 > Fax: +1 (973) 438-1464 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >