Optimizing deterministic code - directive to creating compiled code without choice points

This is a side note off the main thread, and I can’t recall if I dropped this link to you before so forgive me if I have, but many years ago when I wanted/needed to learn more about how choice-points were made/worked instead of taking the route of examining how existing code worked, I started from the basement and learned how to write a Prolog interpreter. I didn’t say ground level because the basic interpreter was already written.

While there are many implementations on the web and many in GitHub alone, at the time I was living in functional languages and used this one (miniprolog) based on OCaml. While it can do inferencing and create choice points, as it notes, it lacks cut and even the ability to do list, but it helped me greatly in understanding how choice-points were created and worked.

If you choose to go down the path of building a Prolog interpreter from the basement up and want to use a different set of code than noted, validate that the code does inferencing correctly as many of these example code drops will fail basic inferencing test and thus will do more harm than good.