Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Selentek 24331-03 <epifanov@k...>
Subject: [Caml-list] optional arguments
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 -> i + 1
  | None   -> 0

.

First solution:

match a with
| Some i -> f ~v:i ()
| None   -> 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