News for hackers. Stuff that matters.
Re:Scryer Prolog by tannhaeuser on Saturday February 04, 2023 @11:12AM (#34655487)
Nit: a page advertising ISO Prolog shouldn't start with non-ISO builtins such as append/3 however widespread append or the belief it's in ISO may be. Here's a variant using atom_concat/3 which is actually defined by ISO:

    ?- 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

Re:Scryer Prolog by triska on Saturday February 04, 2023 @11:16AM (#34655521)
append/3 is a so-called extension of the standard. This means that every conforming system is free to provide this predicate, because it causes no ambiguity or contradiction with the standard:

    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.
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 this case, it 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.
Re:Scryer Prolog by tannhaeuser on Saturday February 04, 2023 @11:51AM (#34655840)
> append/3 is only available if library(lists) is loaded

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.

Re:Scryer Prolog by falsissime on Sunday February 05, 2023 @03:13AM (#34662953)
Any progress for Quantum conformity wise? It's doc reads is a full ISO Prolog implementation https://quantumprolog.sgml.io/docs/langreference.html