Prolog & others

Prolog & others

62 bookmarks
Newest
Game Programming in Prolog - Part 1
Game Programming in Prolog - Part 1
This article explains how a game can be made in Prolog by leveraging the hidden power of logic programming. Inspired by the elegance of data-driven design and declarative programming paradigms, I will be explaining a new way of designing game rules which can at the same time be used as the source code of the gameplay system itself.
·thingspool.net·
Game Programming in Prolog - Part 1
An Executable Specification of Oncology Dose-Escalation Protocols with Prolog
An Executable Specification of Oncology Dose-Escalation Protocols with Prolog

We present, as a pure Prolog program, the first executable specification of the 3 + 3 dose-escalation protocol commonly used in early-phase oncology drug development. In this program, the imperative operations of the protocol emerge as consequences of clinically meaningful anticipatory-regret scenarios that are declared as CLP(ℤ) constraints. This ‘regret-constrained’ (RC) specification yields a robust formulation which can be used to prove clinically meaningful safety and liveness properties of the protocol before incorporating it into a trial, and then as an on-line decision support system while the trial is underway. Our RC specification also readily accommodates certain pragmatic modifications to trial enrollment which severely strain traditionally imperative formulations. The features of modern Prolog systems let us describe the 3 + 3 protocol with a short and general program that has desirable algebraic properties and can therefore be used, tested and reasoned about in several different ways.

·up.raindrop.io·
An Executable Specification of Oncology Dose-Escalation Protocols with Prolog
Indexing dif/2
Indexing dif/2

Many Prolog programs are unnecessarily impure because of inadequate means to express syntactic inequality. While the frequently provided built-in dif/2 is able to correctly describe expected answers, its direct use in programs often leads to overly complex and inefficient definitions — mainly due to the lack of adequate indexing mechanisms. We propose to overcome these problems by using a new predicate that subsumes both equality and inequality via reification. Code complexity is reduced with a monotonic, higher-order if-then-else construct based on call/N. For comparable correct uses of impure definitions, our approach is as determinate and similarly efficient as its impure counterparts.

·up.raindrop.io·
Indexing dif/2
Portability of Prolog programs: theory and case-studies
Portability of Prolog programs: theory and case-studies
(Non-)portability of Prolog programs is widely considered as an important factor in the lack of acceptance of the language. Since 1995, the core of the language is covered by the ISO standard 13211-1. Since 2007, YAP and SWI-Prolog have established a basic compatibility framework. This article describes and evaluates this framework. The aim of the framework is running the same code on both systems rather than migrating an application. We show that today, the portability within the family of Edinburgh/Quintus derived Prolog implementations is good enough to allow for maintaining portable real-world applications.
·up.raindrop.io·
Portability of Prolog programs: theory and case-studies
Lambdas in ISO Prolog
Lambdas in ISO Prolog

Higher order programming is possible in Prolog. There is no need to extend the language for that. See Richard O'Keefe's arguments in comp.lang.prolog more than ten years ago. What is missing are lambda expressions.

We present a very simple implementation of lambda expressions in ISO Prolog that fits into the existing conventions for higher order predicates based on call/N. No syntax or compiler extension is needed.

·up.raindrop.io·
Lambdas in ISO Prolog
DCGs + Memoing = Packrat Parsing. But is it worth it?
DCGs + Memoing = Packrat Parsing. But is it worth it?
Packrat parsing is a newly popular technique for efficiently implementing recursive descent parsers. Packrat parsing avoids the potential exponential costs of recursive descent parsing with backtracking by ensuring that each production rule in the grammar is tested at most once against each position in the input stream. This paper argues that (a) packrat parsers can be trivially implemented using a combination of definite clause grammar rules and memoing, and that (b) packrat parsing may actually be significantly less efficient than plain recursive descent with backtracking, but (c) memoing the recognizers of just one or two nonterminals, selected in accordance with Amdahl’s law, can sometimes yield speedups. We present experimental evidence to support these claims.
·up.raindrop.io·
DCGs + Memoing = Packrat Parsing. But is it worth it?
The birth of Prolog
The birth of Prolog
The programming language, Prolog, was born of a project aimed not at producing a programming language but at processing natural languages; in this case, French. The project gave rise to a preliminary version of Prolog at the end of 1971 and a more definitive version at the end of 1972. This article gives the history of this project and describes in detail the preliminary and then the final versions of Prolog. The authors also felt it appropriate to describe the Q-systems since it was a language which played a prominent part in Prolog’s genesis.
·up.raindrop.io·
The birth of Prolog