I have a long standing love affair with Prolog and frustration for its failure to grow. Prolog has poor features for abstraction and is actually not declarative enough! Prolog's limitations can be great for starting to get the paradigm but then you hit a wall. (Kind of like standard Pascal!) Mercury and Curry fix some of these limitations as does miniKanren. Integrating CLP is important yet so far always clumsy as st…
The Simplicity of Prolog
111–120 of 134 posts
Re: The Simplicity of Prolog
#112Earlier quoted context omitted.
Not specifically aimed at this comment, but it looks like in most Prolog threads here, many commenters seems to plugging in Scryer Prolog, but perhaps, SWI is the most 'batteries included' and mature Prolog implementation for people not familiar with Prolog to try out .
SWI Prolog 7 added "X = Dict.key" syntax and that use of "." makes it fundamentally incompatible, ISO standard breaking, backwards incompatible to previous Prologs, sideways incompatible to other Prologs. This is a worse sin in Prolog than it seems at a glance, because one of the strengths Prolog has is code-is-data / data-is-code metaprogramming. That includes exporting code as Prolog terms (use cases you might use…
Find the lectures here: https://www.youtube.com/@ThePowerOfProlog
Re: The Simplicity of Prolog
#113Earlier quoted context omitted.
Respectfully have to disagree. Prolog has the best features for abstraction of any language I've used, I suspect it may be near an optimal fixed point for metaprogramming expression[3]. I will say the other side of that wall is breathtaking. Also not sure what you mean, CLP is a first class consideration in many Prologs, esp Scryer Prolog. Check these crazy demos out: [1] https://youtu.be/h5Xy4YjCZxM [2] https://yout…
You have "Rows" repeated eight times in this short snippet. You have all the rest of your variables as two letter names. It feels low level, almost like Fortran.
Re: The Simplicity of Prolog
#114Earlier quoted context omitted.
A lot of these comments don't make any sense to me. > Prolog predicates are not first class values. Predicates are trivially called, even as variables, with the `call/N` metapredicate. > Mapping and filtering is awkward In what sense? The declarative semantics...? > Arithmetic is awkward In what sense...? Have you seen clpz? > The CLP examples aren't integrated with Prolog's Horn clause resolution model In what sense…
> Predicates are trivially called, even as variables, with the `call/N` metapredicate. Yes, that is the definition of "predicates are not first class values". Some things can be called without call/N. Other things can not be called without call/N. These are two separate classes of things. Both of these classes cannot be the first class.
"First class" meaning, can be the arguments to a predicate or processed as data.
Predicates (and only predicates) can be called with `call/N` -- although you could write a meta-interpreter with different properties. You could pass in the number `1` and call a randomly determined predicate, as an absurd example.
Perhaps you mean, "the head and body of a predicate are not first class" ? This again is false. They are valid data and can be processed as such -- please see [4] for clarification.
Perhaps you mean "they cannot be looked up dynamically at runtime" -- this is also false, please see [3].
Are there other eligibility requirements for "first class" that we should discuss?
Re: The Simplicity of Prolog
#115In a long forgotten past a large part of my graduation was Prolog (I was as far ahead then as i'm behind now with the ol' AI thing; I worked on mixing neural nets, reasoning with uncertainty with Prolog at the time) and, after hallucinatory episodes living, sleeping, (day)dreaming in Prolog for months on end, when something was finished I was always so surprised how clean, readable and 'too little' the code looked fo…
I really wish there was "regex for prolog", ie: when pounding away in JavaScript be able to do: let options = { foo: 1, bar: 2, ... } ```prolog $X :- fromJson( options ) Solution = Optimize( $X ) ... ``` ...like writing a whole web app in prolog sounds terrifying (same as writing a whole web app in regex), but recognizing and having some excellent interop between "modes" is obviously useful for regex, sometimes sql i…
https://github.com/Anniepoo/swiplwebtut/blob/master/web.adoc
Re: The Simplicity of Prolog
#116I started learning prolog just a few months ago, when I stumbled upon https://linusakesson.net/dialog/ which is a spin on prolog optimized for writing interactive fiction. As a sweet and short tutorial I can recommend these slides: https://www.cs.toronto.edu/~hojjat/384w10/ If you want to dive into how Prolog works under the hood I can recommend https://github.com/a-yiorgos/wambook I terms of Prolog implementations I…
I read about dialog in another HN thread a few weeks ago. Between then and now I've had the itch to write some interactive fiction, but I could not for the life of me remember the name of that project. Thanks!
Re: The Simplicity of Prolog
#117Earlier quoted context omitted.
one example that changed my view of prolog was http://faculty.cooper.edu/smyth/cs225/ch7/prolog.htm (a toy compiler in prolog)
And this is nothing new. People already knew how to write compilers in Prolog (easily) in the 90s. The problem with Prolog is that it requires a change in the way you think about problems, to a more declarative way. Programmers are in general not willing to do this since the result will be not as performant as what they can do with C. There must be a revolution in programming education and tools before people fully u…
A lot of programmers resist learning anything new, for various reasons, but most charitably because they are never exposed to new ideas or paradigms.
Re: The Simplicity of Prolog
#118FYI, composer 2 (the official PHP package manager) uses prolog to figure out if a package can be installed or not. When it’s not possible, you get a detailed explanation why it’s not possible
Re: The Simplicity of Prolog
#119Am I the only who finds this article to be inaccessible due to color choices and implementation? I'm really interested in Prolog, but my eyes feel the strain after a few sentences. The reason is that the contrast ratio of some parts is very low, of others excessively high. The constant alternations between these extremes intensifies the effect. The page looks shredded in Safaris reader mode, so that's no help either.
Re: The Simplicity of Prolog
#120> While SQL isn't normally used as a general purpose programming language I think it's quite illustrative for those otherwise unfamiliar with declarative languages (though apparently it is Turing complete) SQL itself is not Turing complete in its standard form because it lacks some essential features of a Turing machine, such as the ability to simulate unbounded loops or recursion within a single query. SQL with proc…
SQL with CTEs is also Turing complete, which is not necessarily ideal. The Rule of Least Power https://en.m.wikipedia.org/wiki/Rule_of_least_power suggests avoiding OP languages. Less powerful languages can be more transparent (great for expressing contracts, e.g. specifications), tractability (proofs, optimization, termination, etc.) and so on. Many systems have been ruined by making them Turing complete.
It is a great strength of the popular subset of SQL that it is _not_ Turing complete.