mthom / scryer-prolog

A modern Prolog implementation written mostly in Rust.
BSD 3-Clause "New" or "Revised" License
2.06k stars 123 forks source link

Documentation for consult/1 (and other predicates from loader.pl) #2020

Open bakaq opened 1 year ago

bakaq commented 1 year ago

Not sure if this is the right place to put this but I couldn't find an issue tracker for the documentation site.

I've been learning Prolog for the past months and the Scryer Prolog documentation has been an incredible resource, specially for libraries such as clpz. However I've noticed that it lacks documentation for a bunch of important predicates, such as consult/1, (<)/2, (@<)/2, copy_term/2, sort/2, (is)/2, etc... For these I end up using SWI-Prolog's documentation, which isn't ideal because it's not Scryer (so maybe there are differences in some predicates or documentation which isn't relevant), and also because frankly that site is a mess.

It seems that the problem with most of those is that they are built-in in the interpreter, and if I understand it correctly the documentation is generated from the source code of the libraries with DocLog, so these predicates aren't documented because they don't have a source implementation. I guess I should create another issue for these if this issue tracker is really the right place for this.

consult/1, on the other hand, seems to be defined in loader.pl, which if I understand correctly is also built-in in the interpreter, but at least it has a source which makes documenting it easier in theory.

triska commented 1 year ago

This may mean that we need, in addition to the current section on "Libraries", a section for standard predicates. A good overview of all ISO standard predicates is available from the Prologue page:

http://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue

With the exception of consult/1, the predicates you mention are all standard predicates. Strictly speaking, Scryer must not provide consult/1 in its strictly conforming execution mode, but it can provide consult/1 as a conforming extension (not modification!) of the standard, like other predicates that reside in libraries and which are only available after loading these libraries, or only on the toplevel which is outside the scope of the standard.

A key advantage of the strictly conforming execution mode is that we can use Scryer to test portability of Prolog applications to other Prolog systems that adhere to the standard.

bakaq commented 1 year ago

Added a task list for this.

jjtolton commented 2 months ago

Is there a technical reason why the "special form" (lisp terminology) equivalent predicates can't be stubbed out as they are in Python's builtin module?