Login

tee/fmt

# #require "fmt";;
# Format.printf "%a\n" (Fmt.list Fmt.int) [1;2;3;4];;
123
4
- : unit = ()

huh? This is Format weirdness. Open a box:

# Format.printf "@[%a@]\n" (Fmt.list Fmt.int) [1;2;3;4];;
1234
- : unit = ()

Fmt.Dump tries to render as OCaml:

# Format.printf "@[%a@]\n" (Fmt.Dump.list Fmt.int) [1;2;3;4];;
[1; 2; 3; 4]
- : unit = ()
# Format.printf "@[%a@]\n" (Fmt.Dump.list (Fmt.Dump.pair Fmt.int Fmt.int)) [1, 0;2, -1;3, -2;4, -3];;
[(1, 0); (2, -1); (3, -2); (4, -3)]
- : unit = ()
# Format.printf "@[<v>%a@]\n" (Fmt.list (Fmt.Dump.pair Fmt.int Fmt.int)) [1, 0;2, -1;3, -2;4, -3];;
(1, 0)
(2, -1)
(3, -2)
(4, -3)
- : unit = ()