- Automatic detection and compilation of partial strings
- Streams, including sockets
- Garbage collection in anticipation of very fast yet logically pure I/O
- Improvements to the instruction dispatch loop (many opportunities for enhancement there, probably a good place to start for a beginning contributor)
In the past few months, we've added delimited continuations, tabling, partial strings, and Markus' CLP(B), CLP(ℤ) and format libraries. For a hobbyist project I'd say we're moving at a fairly quick pace!
Longer term, we're interested in:
- JIT compilation to native code (Cranelift seems a good candidate?)
- Low-level integration with Common Lisp environments
I'd love to have system-level contributors, although library contributions are always very welcome!
In the hope to attract further contributors to Scryer Prolog, especially with interest in Rust, I have now created a GitHub issue that collects a few self-contained features that could be interesting to look into for Rust programmers:
https://github.com/mthom/scryer-prolog/issues/319
I hope that's OK, and I invite everyone who is interested in these topics to contribute to this very innovative new Prolog system! Already in this early stage, it provides several important features that no other system currently has. Thank you again!
Sounds interesting, do you have a link or something else to share regarding your conception of logically pure I/O?
https://github.com/SWI-Prolog/swipl-devel/blob/master/librar...
this (I assume) is the library(pio) mentioned in the github issue
Also, there is now ample room for input that SWI once almost offered.
!
As well as an exclamation I suppose that's the cut on my "write a prolog to learn rust" predicate, backtracking to finding out more about this, especially since I just came across a little puzzle for which integer constraint programming is perfect this week.
One of my goals with this specific form of presentation is to counteract "skimming" by making it unrewarding: When readers are tempted to "skim" a chapter, they usually find out that they were already almost at the end of the chapter, so reading the entire chapter and thinking about the content becomes the preferred strategy.
One potential drawback of this approach is that readers who do not want to think about the content, or do not read the material with the required focus may come to the conclusion that it is too terse.
In my opinion, what matters here, maybe more than in other texts, is the strategy of reading that is required to best absorb the material. I am doing my best to ensure that it is all there. Yet, the full potential is only realized with active cooperation from the reader. I think it would be possible to convey some of the points also with lengthier explanations, though at the substantial cost of sacrificing peak impact potential. I am very glad to hear that this approach is working well for you, thank you a lot for your feedback!
I greatly enjoy all your postings about your Prolog-based interpreter for Joy:
https://osdn.net/projects/joypy/scm/hg/Joypy/blobs/tip/thun/...
I impulsively upvote this every time I see it. Thank you for sharing such an interesting project!
Your advice to use CLP(FD) for the semantics of integer math operations was fantastic!
I typically use SWI Prolog but I hope the code is mostly portable. The parser uses a couple of DCGs from the "basics" lib but I think those are also portable or at least simple to re-implement.
The tricky bit might be the semantics of math (and comparison) ops. I've tried two other sets of semantics, one that attempts to perform math operations (and catch the errors if e.g. an arg is a logic var rather than an int) as you go, and another that just builds expression trees (evaluation is delayed) like so:
func(+, [int(A), int(B)|S], [int(A + B)|S]).
Just to point out, in SWI Prolog the ints are "BigNums" while in GNU
Prolog they're machine words (so modular arithmetic, mod 2^32). You
could use Rationals or make up some other semantics. This all gets into
Categorical paradigm programming. http://conal.net/papers/compiling-to-categories/
The same (point-free) expression can be used to develop concrete programs
over various categories: Hardware circuits, partial evaluation,
differentiation, dataflow graphs, and so on.As someone with only fleeting knowledge of Prolog, this was by far the best introduction I've come across.
:- use_module(library(clpfd)).
at the top of your file (or just use_module(library(clpfd)). at the console) :- use_module(library(clpz)).
for its successor which runs with SICStus and Scryer.
I hope you are all doing reasonably well. Please take care!
This book was most recently discussed here in May 2018:
https://news.ycombinator.com/item?id=17121028
Since then, I have added a new chapter, Logical Foundations of Prolog:
https://www.metalevel.at/prolog/logic
Also, I have made several other additions and improvements. You can see most of the changes since the last discussion in a public git repository:
https://github.com/triska/the-power-of-prolog/compare/8a94ed...
Currently, I am working on several videos that will eventually form the core of the book. Here are a few previews:
https://www.metalevel.at/prolog/videos/logic
https://www.metalevel.at/prolog/videos/timetabling
https://www.metalevel.at/prolog/videos/sparrows_on_eagles
These videos are all work in progress, and they may be replaced by better versions at any time. Hence, if possible, please use the links above to refer to them: They will always point to the latest versions.
Alternatively, please use the following overview page that shows all videos:
https://www.metalevel.at/prolog/videos/
Also, I have published a comprehensive journal paper about my CLP(B) system, i.e., a SAT solver with some nice algebraic properties, seamlessly integrated into Prolog as a specialized form of unification:
https://www.metalevel.at/boolean.pdf
For Prolog application programmers and system implementors, the paper's appendices may be especially interesting. They formalize a few important concepts that are also a major theme in the book.
As of October 2019, the CLP(B) system is also available in Mark Thom's Scryer Prolog. Scryer is a Rust-based Prolog implementation that is freely available, conforms to the Prolog ISO standard, represents strings efficiently as lists of characters, and includes important features for implementing Prolog-based constraint solvers:
https://github.com/mthom/scryer-prolog
As of a few days ago, Scryer Prolog also ships with my implementation of CLP(ℤ), Constraint Logic Programming over integers. This is a very useful declarative paradigm for solving combinatorial tasks, in some ways superior to SAT solving because it allows more convenient modeling, easier experimentation with different formulations, and reasoning at a higher conceptual level. The chapter on declarative integer arithmetic contains more information, and further pointers:
https://www.metalevel.at/prolog/clpz
For illustration, here is an example page where you can solve timetabling instances with this approach:
https://www.metalevel.at/prolog/timetabling/
I welcome all comments and suggestions about the book, these videos, and Prolog in general. Also, I would like to take this opportunity to thank all readers for your thoughtful comments and endorsements. Your feedback and encouragement are making this work especially worthwhile.
Enjoy!