[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alain Frisch <alain@f...> |
| Subject: | Re: [Caml-list] Deconstructing optional arguments |
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