From: Markus Triska Date: Tue, 16 Nov 2021 17:20:58 +0000 (+0100) Subject: mention the format("~s", [Ls]) pattern and new library(pio) predicates X-Git-Tag: v0.9.0~24^2~5 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=23df16ecf9a20b61efdf78a91519afbc8d691667;p=scryer-prolog.git mention the format("~s", [Ls]) pattern and new library(pio) predicates --- diff --git a/src/lib/format.pl b/src/lib/format.pl index 1bc32a62..a2a84de9 100644 --- a/src/lib/format.pl +++ b/src/lib/format.pl @@ -56,7 +56,12 @@ If at all possible, format_//2 should be used, to stress pure parts that enable easy testing etc. If necessary, you can emit the list Ls - with maplist(put_char, Ls). + with maplist(put_char, Ls) or, much faster, with format("~s", [Ls]). + Ideally, however, you use phrase_to_file/2 or phrase_to_stream/2 + from library(pio) to write the described list directly to a file + or stream, respectively: phrase_to_stream(format_(..., [...]), S). + The advantage of this is that an ideal implementation writes + the characters as they become known, without manifesting the list. The entire library only works if the Prolog flag double_quotes is set to chars, the default value in Scryer Prolog. This should