From the hub
Graph Traversal for Problem Solving
This post is external to PrologHubAn example of using depth first and breadth first searches (written to be nearly identical to highlight the subtle difference between a stack and a queue) to solve three common puzzles commonly used as examples in AI textbooks.
Operators for a Controlled Natural Language
Prolog allows us to declare our own operators, this allows us to quickly take a bunch of predicates and query them in a bodge-job controlled "semi-natural" language.
Multifile predicates: dos and don'ts
This post is external to PrologHubMultifile predicates are a standard Logtalk and Prolog feature. The name multifile originates from being able to define a predicate in multiple files. Multifile predicates are declared ...
DCGs provide a threading state abstraction: don't break it
This post is external to PrologHubDefinite Clause Grammars (DCGs) provide a useful threading state abstraction with countless applications in Logtalk and Prolog programming. But programmers sometimes break this abstraction without realizing it and for no benefit. This usually happens when ...
Consuming JSON from an API
SWI-Prolog can be a little quirky when trying to get data from a JSON API endpoint into your program. However, a working example goes a long way to stress-free programming! In this post we'll consume some data and discuss a couple of the options available to you.
Various ways to iterate in Prolog
This post is external to PrologHubThis is a list of simple examples, mainly created for my own reference, on the numerous ways of list processing in Prolog. My original title was six ways to iterate in Prolog, but it's reached 11 and still counting.
Code Layout for Lists, Dicts and Module Predicates
Many organizations and some languages have definitive style-guides describing how an author should layout their code to improve readability. The rules are designed to be easy on the eye and provide consistency for multi-author projects. For better or worse, Prolog seems to be spared from an authoritative prescriptive document, such as Python's PEP8. In this post I'll opine about some practices that you may find useful.