From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA26416; Mon, 17 Nov 2003 10:03:00 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA26005 for ; Mon, 17 Nov 2003 10:02:57 +0100 (MET) Received: from ns.ntt.ru (ns.ntt.ru [195.28.32.3]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hAH92s105069 for ; Mon, 17 Nov 2003 10:02:56 +0100 (MET) Received: from ns.ntt.ru (root@localhost) by ns.ntt.ru (8.12.9/8.12.9) with SMTP id hAH935AF063004 for ; Mon, 17 Nov 2003 12:03:05 +0300 (MSK) From: Selentek 24331-03 Received: from inv_machine ([195.28.33.227]) by ns.ntt.ru (8.12.9/8.12.9) with ESMTP id hAH92x7C062966 for ; Mon, 17 Nov 2003 12:03:02 +0300 (MSK) Received: by inv_machine (Postfix, from userid 1000) id 1ACBCAD19; Mon, 17 Nov 2003 11:52:49 +0300 (MSK) Date: Mon, 17 Nov 2003 11:52:49 +0300 To: caml-list@inria.fr Subject: [Caml-list] optional arguments Message-ID: <20031117085249.GA11793@inv_machine> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; val:01 funtion:01 int:01 match:02 match:02 argument:03 arguments:03 let:04 let:04 send:93 defined:07 function:09 something:09 something:09 solution:10 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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