From: Alain Frisch <alain@frisch.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Deconstructing optional arguments
Date: Fri, 11 Apr 2008 12:06:13 +0200 [thread overview]
Message-ID: <47FF3815.2040309@frisch.fr> (raw)
In-Reply-To: <200804111024.16296.jon@ffconsultancy.com>
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
next prev parent reply other threads:[~2008-04-11 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 9:24 Jon Harrop
2008-04-11 10:06 ` Alain Frisch [this message]
2008-04-11 10:36 ` [Caml-list] " Olivier Andrieu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47FF3815.2040309@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox