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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AAFE0BBC1 for ; Fri, 11 Apr 2008 12:06:17 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ak8BAOfU/kfB/BYfb2dsb2JhbACRTwEMBQIFBxiZeQ X-IronPort-AV: E=Sophos;i="4.25,640,1199660400"; d="scan'208";a="10747528" Received: from smtp20.orange.fr ([193.252.22.31]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Apr 2008 12:06:17 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2021.orange.fr (SMTP Server) with ESMTP id E1FDC1C000B8; Fri, 11 Apr 2008 12:06:16 +0200 (CEST) Received: from [192.168.1.66] (APuteaux-154-1-60-91.w81-249.abo.wanadoo.fr [81.249.67.91]) by mwinf2021.orange.fr (SMTP Server) with ESMTP id 9B2171C00098; Fri, 11 Apr 2008 12:06:16 +0200 (CEST) X-ME-UUID: 20080411100616635.9B2171C00098@mwinf2021.orange.fr Message-ID: <47FF3815.2040309@frisch.fr> Date: Fri, 11 Apr 2008 12:06:13 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Deconstructing optional arguments References: <200804111024.16296.jon@ffconsultancy.com> In-Reply-To: <200804111024.16296.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 wrote:01 caml-list:01 alain:01 alain:01 argument:02 argument:02 let:03 let:03 pattern:04 arguments:07 label:07 optional:09 optional:09 Jon Harrop wrote: > Is it possible to deconstruct an optional argument as you can with a labeled > argument: > > let f ~p:(x,y) () = x - y > > with something like: > > let f ?(p=0,0):(x,y) () = x - y Yes, of course. The default value is attached to the pattern, not to the label: let f ?p:((x,y)=(0,0)) () = x - y;; -- Alain