<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Zoltan,<div class=""><br class=""></div><div class="">I already had:</div><div class=""><br class=""></div><div class=""><font face="Courier New" style="font-size: 14px;" class="">:- type rop<br class=""> ---> t(string)<br class=""> ; tnl(string)<br class=""> ; nl<br class=""> ; tab(list(rop))<br class=""> ; rops(list(rop)).</font></div><div class=""><br class=""></div><div class="">By adding a new type constructor, which I have done,</div><div class=""><br class=""></div><div class=""><font face="Courier New" style="font-size: 14px;" class=""> ; seq(string, list())</font></div><div class=""><br class=""></div><div class="">I now have a generalised way of outputting a sequence of terms separated by whataver is in the string value. I have created a mini-DSL of sorts that handles output formatting for me, for example, to output a general function call I compose this:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier New" style="font-size: 14px;" class=""> Call = rops([</font></div><div class=""><font face="Courier New" style="font-size: 14px;" class=""> t(FunctionName), t("("), seq(“, “, ArgsOut), t(")")</font></div><div class=""><font face="Courier New" style="font-size: 14px;" class=""> ]),</font></div></div><div class=""><br class=""></div><div class="">and then I extended my mini language to handle a seq() and do the right thing getting me what I need.</div><div class=""><br class=""></div><div class="">Sean.</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 21 Dec 2021, at 16:36, Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com" class="">zoltan.somogyi@runbox.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><br class="">On Tue, 21 Dec 2021 16:21:06 +0000, "Sean Charles (emacstheviking)" <<a href="mailto:objitsu@gmail.com" class="">objitsu@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">If I have a list of strings I can use<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>string.join_list(Separator, Strings)<br class=""><br class="">but if I have a list of things, and I want to separate them all with a list of another thing within the same type…?<br class=""><br class="">I have a formatted output system, it encapsulates text in various type constructors<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>t(string)<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>tnl(string)<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>etc<br class=""><br class="">so given a list<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>[ t(“arg1”), t(“arg2”) ]<br class=""><br class="">how do I arrive at<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>[ t(“arg1”), t(“, “), t(“arg2”) ]<br class=""></blockquote><br class="">There is no predicate or function in the Mercury standard library<br class="">that does this. On the other hand, there are several different versions<br class="">of it in the error message formatting module of the compiler,<br class="">error_util.m, that all do slightly different versions of this job.<br class="">Some generate output such as "1, 2, 3" (just putting ", " between<br class="">successive integers), while others treat the gap between the<br class="">last pair of elements differently, generating output such as<br class="">"1, 2 and 3".<br class=""><br class=""><blockquote type="cite" class="">I COULD introduce a new type constructor called csv() but …. just asking for a friend etc.<br class=""></blockquote><br class="">I don't understand how a new type constructor would help.<br class=""><br class="">Zoltan.<br class=""><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>