diff --git a/core/src/lib.rs b/core/src/lib.rs index fa0ad48523..7be244471b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -97,6 +97,21 @@ pub use math::{ pub mod prettier { pub use miden_formatting::{prettier::*, pretty_via_display, pretty_via_to_string}; + + /// Pretty-print a list of [PrettyPrint] values as comma-separated items. + pub fn pretty_print_csv<'a, T>(items: impl IntoIterator) -> Document + where + T: PrettyPrint + 'a, + { + let mut doc = Document::Empty; + for (i, item) in items.into_iter().enumerate() { + if i > 0 { + doc += const_text(", "); + } + doc += item.render(); + } + doc + } } mod operations;