Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003882OCamlOCaml generalpublic2005-11-21 10:462015-04-17 09:32
ReporterJean-Christophe Filliatre 
Assigned Togasche 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.02.0 
Summary0003882: Wish: Format.pp_print_list
DescriptionThis is a feature wish.

It would be nice to have a function in Format to print lists, that is something

  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 ",@ ")
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2015-04-17 09:32

This was fixed in 4.02 thanks to Daniel B├╝nzli's PR#6009.

- Issue History
Date Modified Username Field Change
2005-11-21 10:46 Jean-Christophe Filliatre New Issue
2005-11-22 13:00 doligez Status new => acknowledged
2015-04-17 09:32 gasche Note Added: 0013687
2015-04-17 09:32 gasche Status acknowledged => resolved
2015-04-17 09:32 gasche Fixed in Version => 4.02.0
2015-04-17 09:32 gasche Resolution open => fixed
2015-04-17 09:32 gasche Assigned To => gasche

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker