Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Ocaml variadic function problem
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 1st June 18:11
arthur j. odwyer
External User
 
Posts: 1
Default Ocaml variadic function problem



I currently have the following code defining the function 'debugf'. I
would like to have the same function return 'unit' instead of 'string',
though. How do I change the definition to make 'debugf "foo"' usable
in a 'unit' context?


let print_debug s = if (!debug) then (
Printf.printf "%s" s;
Pervasives.flush stdout
)

let debugf fmt_etc =
let k result =
(print_debug result; "")
in
Printf.kprintf k fmt_etc

TIA,
-Arthur
  Reply With Quote


  sponsored links


2 1st June 18:11
thearthur
External User
 
Posts: 1
Default Ocaml variadic function problem



one approach (that will generate a warning) is to
not use it as the last statment in a function so
its result is ignored. (i may not be understanding
your question)
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666