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 CAA04228; Fri, 31 Aug 2001 02:33:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA04403 for ; Fri, 31 Aug 2001 02:33:37 +0200 (MET DST) Received: from smtp.nwlink.com (smtp.nwlink.com [209.20.130.57]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f7V0Xa513824 for ; Fri, 31 Aug 2001 02:33:36 +0200 (MET DST) Received: from ip178.usw22.rb1.bel.nwlink.com (ip178.usw22.rb1.bel.nwlink.com [207.202.195.178]) by smtp.nwlink.com (8.9.3/8.9.1) with SMTP id OAA21552 for ; Thu, 30 Aug 2001 14:44:09 -0700 (PDT) Received: (qmail 31540 invoked by uid 500); 30 Aug 2001 21:45:40 -0000 Date: Thu, 30 Aug 2001 14:45:40 -0700 From: Michael Leary To: caml Subject: [Caml-list] syntax for variable arity? Message-ID: <20010830144540.D31317@ip178.usw22.rb1.bel.nwlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I want to write a function to abstract a series of functions with different numbers of args like these two: let debug message = printf "Debug %s\n" message; fso let debug_line start_angle start_radius end_angle end_radius = printf "DebugLine %f %f %f %f\n" start_angle start_radius end_angle end_radius; fso I was thinking of: type command = Debug | Debug_line | ... let com command _ = match command with | Debug -> doit "some special format string" _ | Debug_line -> doit "other format string" _ let doit _ = printf _ ; fso (* fso defined elsewhere *) let () = com Debug "debug message" ... let () = com Debug_line start_angle start_radius end_angle end_radius I know _ matches any value(s??), but I'm not clear on how to use the match elsewhere... am I close? Is there a better way to structure this? -- ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr