Module Print


module Print: sig .. end
Printing functions using module Format


Printing functions for standard datatypes (lists,arrays,...)



In the following functions, optional arguments ?first, ?sep, ?last denotes the formatting instructions (under the form of a format string) issued at the beginning, between two elements, and at the end.

The functional argument(s) indicate(s) how to print elements.

val list : ?first:(unit, Format.formatter, unit) Pervasives.format ->
?sep:(unit, Format.formatter, unit) Pervasives.format ->
?last:(unit, Format.formatter, unit) Pervasives.format ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
Print a list
val array : ?first:(unit, Format.formatter, unit) Pervasives.format ->
?sep:(unit, Format.formatter, unit) Pervasives.format ->
?last:(unit, Format.formatter, unit) Pervasives.format ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a array -> unit
Print an array
val pair : ?first:(unit, Format.formatter, unit) Pervasives.format ->
?sep:(unit, Format.formatter, unit) Pervasives.format ->
?last:(unit, Format.formatter, unit) Pervasives.format ->
(Format.formatter -> 'a -> unit) ->
(Format.formatter -> 'b -> unit) -> Format.formatter -> 'a * 'b -> unit
Print a pair
val hash : ?first:(unit, Format.formatter, unit) Pervasives.format ->
?sep:(unit, Format.formatter, unit) Pervasives.format ->
?last:(unit, Format.formatter, unit) Pervasives.format ->
?firstbind:(unit, Format.formatter, unit) Pervasives.format ->
?sepbind:(unit, Format.formatter, unit) Pervasives.format ->
?lastbind:(unit, Format.formatter, unit) Pervasives.format ->
(Format.formatter -> 'a -> unit) ->
(Format.formatter -> 'b -> unit) ->
Format.formatter -> ('a, 'b) Hashtbl.t -> unit
Print an hashtable

Useful functions


val string_of_print : (Format.formatter -> 'a -> unit) -> 'a -> string
Transforms a printing function into a conversion-to-string function.
val print_of_string : ('a -> string) -> Format.formatter -> 'a -> unit
Transforms a conversion-to-string function to a printing function.
val sprintf : ('a, Format.formatter, unit, string) Pervasives.format4 -> 'a
Better sprintf function than Format.sprintf, as it takes the same kind of formatters as other Format.Xprintf functions.