[m-users.] Printing any value with io.print

Volker Wysk post at volker-wysk.de
Mon Mar 16 05:59:29 AEDT 2020


Am Sonntag, den 15.03.2020, 18:46 +0100 schrieb Volker Wysk:
> I need to write an algebraic data type, as a term, to a string, just
> like io.print does, when it writes it to an output stream. How should
> this be done? I couldn't find a string_output_stream feature... Is
> the
> "format anything" capability of io.print available outside of
> io.print?

I've found it out:

drucken(T, Txt) :-
   Zust1 = string.builder.init,
   stream.string_writer.print(string.builder.handle, T, Zust1, Zust2),
   Txt = string.builder.to_string(Zust2).

Bye
Volker



More information about the users mailing list