diff options
author | Pierre Weis <Pierre.Weis@inria.fr> | 2006-11-06 09:12:53 +0000 |
---|---|---|
committer | Pierre Weis <Pierre.Weis@inria.fr> | 2006-11-06 09:12:53 +0000 |
commit | 044ac2610c4050373d996f588f977f0692779b9f (patch) | |
tree | 0203480c5c0d0cff95c8629f591d714a35aaa851 /stdlib/format.ml | |
parent | 84b420f2fe51049d8512b75451e29f2c91215890 (diff) | |
download | ocaml-044ac2610c4050373d996f588f977f0692779b9f.tar.gz |
New function ifprintf that does not print. (See request #0004031.)
Ifprintf is a one-liner using implementation tools from Printf, whereas it is
not possible to write it in pure Caml.
Useful to conditionally ignore printing.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7717 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/format.ml')
-rw-r--r-- | stdlib/format.ml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/stdlib/format.ml b/stdlib/format.ml index 2eb8f67604..f5deb0674a 100644 --- a/stdlib/format.ml +++ b/stdlib/format.ml @@ -1193,6 +1193,7 @@ let mkprintf to_s get_out = **************************************************************) let kfprintf k ppf = mkprintf false (fun _ -> ppf) k;; +let ifprintf ppf = Printf.kapr (fun _ -> Obj.magic ignore);; let fprintf ppf = kfprintf ignore ppf;; let printf fmt = fprintf std_formatter fmt;; |