mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 03:35:30 -05:00
doc
This commit is contained in:
parent
8da92a7541
commit
3acffa8659
1 changed files with 10 additions and 0 deletions
|
|
@ -42,6 +42,16 @@ Those combinators work with "%a". For instance to print a
|
|||
Remember that "%a" in this context requires two arguments:
|
||||
- a value of type ['a t] (buffer printer)
|
||||
- a value of type ['a] (value to print)
|
||||
|
||||
To define new printers, one can either use existing ones (e.g. [list int]),
|
||||
or use {!Printf.bprintf}. For instance a printer for colored points in 2D:
|
||||
|
||||
{[ type point = {x:int; y:int; colors: string list};;
|
||||
|
||||
let pp_point buf p =
|
||||
Printf.bprintf buf "{x=%d, y=%d, colors=%a}"
|
||||
p.x p.y CCPrint.(list string) p.colors;;
|
||||
]}
|
||||
*)
|
||||
|
||||
type 'a sequence = ('a -> unit) -> unit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue