Commit bf4b10f3 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Add pretty-printer for lists that need separators on the right of elements.

parent 97f1b967
...@@ -27,6 +27,10 @@ let rec print_list_pre sep print fmt = function ...@@ -27,6 +27,10 @@ let rec print_list_pre sep print fmt = function
| [] -> () | [] -> ()
| x :: r -> sep fmt (); print fmt x; print_list_pre sep print fmt r | x :: r -> sep fmt (); print fmt x; print_list_pre sep print fmt r
let rec print_list_suf sep print fmt = function
| [] -> ()
| x :: r -> print fmt x; sep fmt (); print_list_suf sep print fmt r
let print_list sep print fmt = function let print_list sep print fmt = function
| [] -> () | [] -> ()
| [x] -> print fmt x | [x] -> print fmt x
......
...@@ -19,6 +19,9 @@ val print_option_or_default : ...@@ -19,6 +19,9 @@ val print_option_or_default :
val print_list_pre : val print_list_pre :
(formatter -> unit -> unit) -> (formatter -> unit -> unit) ->
(formatter -> 'a -> unit) -> formatter -> 'a list -> unit (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
val print_list_suf :
(formatter -> unit -> unit) ->
(formatter -> 'a -> unit) -> formatter -> 'a list -> unit
val print_list : val print_list :
(formatter -> unit -> unit) -> (formatter -> unit -> unit) ->
(formatter -> 'a -> unit) -> formatter -> 'a list -> unit (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment