Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003882OCamlOCaml generalpublic2005-11-21 10:462005-11-22 13:00
ReporterJean-Christophe Filliatre 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
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
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 ",@ ")
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- 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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker