<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/5d3e596b74eaa9ee75a58da8d20cd9d9"
  from="Selentek 24331-03 &lt;epifanov@k...&gt;"
  author="Selentek 24331-03"
  date="2003-11-17T09:03:00"
  subject="[Caml-list] optional arguments"
  prev="2003/11/00a00848651aca38fdc564b10fb3733f"
  next="2003/11/b1b6c26b87180e07925fada95fea49cd"
  next-in-thread="2003/11/b1b6c26b87180e07925fada95fea49cd"
  prev-thread="2003/11/00a00848651aca38fdc564b10fb3733f"
  next-thread="2003/11/bacc85928dbd73f2643743fc792e3b9b"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] optional arguments">
<msg 
  url="2003/11/5d3e596b74eaa9ee75a58da8d20cd9d9"
  from="Selentek 24331-03 &lt;epifanov@k...&gt;"
  author="Selentek 24331-03"
  date="2003-11-17T09:03:00"
  subject="[Caml-list] optional arguments">
<msg 
  url="2003/11/b1b6c26b87180e07925fada95fea49cd"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-17T10:13:28"
  subject="Re: [Caml-list] optional arguments">
<msg 
  url="2003/11/663dd68fbee6d9f1a5b166cb1c70b6aa"
  from="Selentek 24331-03 &lt;epifanov@k...&gt;"
  author="Selentek 24331-03"
  date="2003-11-17T10:54:03"
  subject="Re: [Caml-list] optional arguments">
</msg>
</msg>
<msg 
  url="2003/11/3f08d78ebc6b3a7418e575aaec0e88e8"
  from="Artem Prisyznuk &lt;tema@s...&gt;"
  author="Artem Prisyznuk"
  date="2003-11-17T10:13:21"
  subject="Re: [Caml-list] optional arguments">
</msg>
<msg 
  url="2003/11/80f6a150cec1a35aec3601f9b5fe1fa8"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-17T16:24:50"
  subject="Re: [Caml-list] optional arguments">
</msg>
</msg>
</thread>

<contents>
Hello,

Is there any way to "send optional argument with None value".
for example:

let a = None;;
val a : 'a option = None

let f ?v () =
  match v with
  | Some i -&gt; i + 1
  | None   -&gt; 0

.

First solution:

match a with
| Some i -&gt; f ~v:i ()
| None   -&gt; f ()

Can I find something more easy with out redifinition of the function ?
something like: f a (), but funtion defined by ``let f ?v'' and ``a'' is int option.


Thanks.

Sorry for my english.
-- 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

