ocaml-containers/utils.ml
Simon Cruanes 924fc1b970 rewrote Deque to be safe (no Obj anymore);
more functions in Deque, especially w.r.t. Sequence;
unit tests for Deque
2013-03-14 14:14:13 +01:00

17 lines
379 B
OCaml

(** {1 Some very basic utils} *)
(* val sprintf : ('a, Format.formatter, unit, string) format4 -> 'a *)
let sprintf format =
let buffer = Buffer.create 32 in
let fmt = Format.formatter_of_buffer buffer in
Format.kfprintf
(begin fun fmt ->
Format.pp_print_flush fmt ();
let s = Buffer.contents buffer in
Buffer.clear buffer;
s
end)
fmt
format