We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original bug ID: 3882 Reporter: Jean-Christophe Filliatre Assigned to: @gasche Status: closed (set by @xavierleroy on 2015-12-11T18:29:28Z) Resolution: fixed Priority: normal Severity: feature Fixed in version: 4.02.0 Category: ~DO NOT USE (was: OCaml general) Monitored by: pzimmer
This is a feature wish.
It would be nice to have a function in Format to print lists, that is something like
val pp_print_list : (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
pp_print_list expects a function to print elements, and return a function to print a list of such elements. This way we could write
fprintf fmt "here is the list %a" (pp_print_list printer) l
It would be even nicer to have a quotation for this. I know that most letters are already used; let's use %z in this example:
fprintf fmt "here is the list %z" printer l
Additionally, it would be nice to be able to indicate a separator to be printed between the list elements, for instance:
val pp_print_list : ?sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
(that would defaults to nothings) and, again, a corresponding quotation:
fprintf fmt "here is the list %Z" printer sep l
where sep is the separator function e.g. (fun fmt () -> fprintf fmt ",@ ")
The text was updated successfully, but these errors were encountered:
Comment author: @gasche
This was fixed in 4.02 thanks to Daniel Bünzli's #6009.
Sorry, something went wrong.
gasche
No branches or pull requests
Original bug ID: 3882
Reporter: Jean-Christophe Filliatre
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:29:28Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.02.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: pzimmer
Bug description
This is a feature wish.
It would be nice to have a function in Format to print lists, that is something
like
val pp_print_list :
(formatter -> 'a -> unit) -> formatter -> 'a list -> unit
pp_print_list expects a function to print elements, and return a function to
print a list of such elements. This way we could write
fprintf fmt "here is the list %a" (pp_print_list printer) l
It would be even nicer to have a quotation for this. I know that most letters
are already used; let's use %z in this example:
fprintf fmt "here is the list %z" printer l
Additionally, it would be nice to be able to indicate a separator to be printed
between the list elements, for instance:
val pp_print_list :
?sep:(formatter -> unit -> unit) ->
(formatter -> 'a -> unit) -> formatter -> 'a list -> unit
(that would defaults to nothings) and, again, a corresponding quotation:
fprintf fmt "here is the list %Z" printer sep l
where sep is the separator function e.g. (fun fmt () -> fprintf fmt ",@ ")
The text was updated successfully, but these errors were encountered: