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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 34A27BC69 for ; Tue, 20 Feb 2007 10:05:25 +0100 (CET) Received: from dorado.vub.ac.be (smtp.vub.ac.be [134.184.129.10]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1K95Oaq011581 for ; Tue, 20 Feb 2007 10:05:24 +0100 Received: from exchange.etro.vub.ac.be (etro10.vub.ac.be [134.184.2.10]) by dorado.vub.ac.be (Postfix) with ESMTP id 4D155727 for ; Tue, 20 Feb 2007 10:05:23 +0100 (CET) Received: from ssel.vub.ac.be ([10.0.4.37]) by exchange.etro.vub.ac.be with Microsoft SMTPSVC(6.0.3790.1830); Tue, 20 Feb 2007 10:05:15 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by ssel.vub.ac.be (Postfix) with ESMTP id AD04A24680CA for ; Tue, 20 Feb 2007 10:05:15 +0100 (CET) X-Virus-Scanned: amavisd-new at ssel.vub.ac.be Received: from ssel.vub.ac.be ([127.0.0.1]) by localhost (ssel.vub.ac.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BCe3Byp4y6rf for ; Tue, 20 Feb 2007 10:05:10 +0100 (CET) Received: from [10.0.4.145] (unknown [10.0.4.145]) by ssel.vub.ac.be (Postfix) with ESMTP id 0702424680C9 for ; Tue, 20 Feb 2007 10:05:10 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <45D9CA6E.8020008@fmf.uni-lj.si> References: <000001c75431$8ab2e8e0$c09ec781@mathiasens> <45D9CA6E.8020008@fmf.uni-lj.si> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <0FFA89B7-7D72-4E67-988F-052D855CD224@vub.ac.be> Content-Transfer-Encoding: 7bit From: Bruno De Fraine Subject: Re: RE : [Caml-list] empty type Date: Tue, 20 Feb 2007 10:05:05 +0100 To: ocaml ml X-Mailer: Apple Mail (2.752.3) X-OriginalArrivalTime: 20 Feb 2007 09:05:15.0820 (UTC) FILETIME=[3C7D76C0:01C754CE] X-Miltered: at discorde with ID 45DAB9D4.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrej:01 redefined:01 infix:01 expr:01 expr:01 syntax:01 val:01 val:01 universiteit:01 vub:98 2007,:98 mathias:98 vub:98 wrote:01 wrote:01 On 19 Feb 2007, at 17:03, Andrej Bauer wrote: > Mathias Kende wrote: >> It's not a type, but just a valid name for a constructor that can be >> redefined if necessary (although one surely does not want to do so). > > Way cool: > > # type t = () of int * int ;; > type t = () of int * int > # () (3, 4) ;; > - : t = () (3, 4) If you redefine :: you get an infix constructor: # type expr = Num of int | :: of expr * expr ;; type expr = Num of int | :: of expr * expr # Num 1 :: Num 2 :: Num 3 ;; - : expr = :: (Num 1, :: (Num 2, Num 3)) # :: (Num 2, Num 3) ;; Syntax error # let a :: b = Num 1 :: Num 2 :: Num 3 ;; Warning P: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: Num _ val a : expr = Num 1 val b : expr = :: (Num 2, Num 3) Bruno -- Bruno De Fraine Vrije Universiteit Brussel Faculty of Applied Sciences, INFO - SSEL Room 4K208, Pleinlaan 2, B-1050 Brussels tel: +32 (0)2 629 29 75 fax: +32 (0)2 629 28 70 e-mail: Bruno.De.Fraine@vub.ac.be