?- atom_concat('Hello, ', X, 'Hello, ISO Prolog!')
You can paste that Prolog code into eg [1] and other sites for execution in the browser btw.[1]: https://quantumprolog.sgml.io/browser-demo/browser-demo.html
?- atom_concat('Hello, ', X, 'Hello, ISO Prolog!')
You can paste that Prolog code into eg [1] and other sites for execution in the browser btw.[1]: https://quantumprolog.sgml.io/browser-demo/browser-demo.html
3.70 extension: A facility provided by the processor
that is not specified in this part of ISO/IEC 13211 but that
would not cause any ambiguity or contradiction if added
to this part of ISO/IEC 13211.
This means that every conforming system is free to provide append/3, because it causes no ambiguity or contradiction with the standard. However, by 5.1, every conforming Prolog system must offer a strictly conforming mode: e) Offer a strictly conforming mode which shall reject
the use of an implementation specific feature in Prolog
text or while executing a goal.
In the case of append/3, this means that there must be a way to run the system without the presence of this predicate. Scryer Prolog satisfies this criterion: In Scryer Prolog, append/3 is only available if library(lists) is loaded, otherwise it is not available. For example, we get: $ scryer-prolog -f
?- append("Hello, ", X, "Hello, Scryer Prolog!").
error(existence_error(procedure,append/3),append/3).
append/3 is part of the suggested Prologue for Prolog:https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue
Strings are a good representation for ephemeral data, where allocating an atom would yield additional overhead, via an entry in the atom table that is not needed elsewhere and can only be reclaimed by GC instead of much faster on backtracking.
Another major attraction of strings is that we can use DCGs to reason about them, and we can write this specific example equivalently as:
?- phrase(("Hello, ",seq(Cs)), "Hello, Scryer Prolog!").
Cs = "Scryer Prolog!".
DCGs are another example of a conforming extension, and they are themselves currently being drafted for inclusion in the Prolog ISO standard. In Scryer Prolog, DCGs are available only when library(dcgs) is loaded, so that its default mode after invocation remains strictly conforming.But it isn't loaded in the example Prolog showcase; that was my point ;)
Now, if it's being loaded via use_module (ie using flawed ISO/IEC 13211-2 modules that shall be forgotten since portability isn't achieved), then it would be at odds with the Prologue for Prolog which assumes it's being imported via ISO-conformant ensure_loaded, rather than as a module.