Print an iterable list-like or set-like data structure, that is a collection with an iter function whose callback will expect one parameter. Default settings:
left
= "{"
sep
= "; "
right
= "}"
empty
: Nonedelim_style
= Ocolor_types.[Faint]
sep_style
= Ocolor_types.[Faint]
elem_style
= []
empty_style
= []
It expects an iter function over the collection and a (pretty) printer for elements of the collection.
delim_style
is applied to left
and right
, sep_style
is applied to sep
and elem_style
is applied to each element. In particular, the pretty printer will work in the context set by elem_style
, so it does not need to apply the same style once again (however, it is harmless).
If empty
is provided and the collection is empty, rather than printing left
right
, empty
will be printed instead, with style empty_style
.
Otherwise, left
is printed, followed by the sep
-separated list of the elements on which the iter function calls its callback (in the same order), followed by right
.