Live data from Hacker News

The Simplicity of Prolog

bitsandtheorems.com

71–80 of 134 posts

Re: The Simplicity of Prolog

#72
post #64

Earlier quoted context omitted.

I'm not riled up, I even upvoted your OP, but it's uncouth to drop a quote without any context as a reply to a comment. Of course there's going to be misunderstandings. I didn't remember that quote from O'Keefe. Prolog is indeed not trying to be smart and SLD-Resolution is dead simple - it's a sound and complete deductive inference system with a single rule. The reason Prolog is in turn so simple is because, thanks t…

TBH, I don't remember where I first read it, but it's all over the web xD. This is all just a misunderstanding: since I knew you were a Prolog expert, I assumed you would recognize my (botched) quote and the context. Yeah, I understand it as: 'better to keep it simple and understandable'

More like a fan than an expert but thanks for the compliment and sorry for yelling at you.

Re: The Simplicity of Prolog

#73
post #23

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…

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…

Prolog predicates are not first class values. Data structures are not abstract. Compare both with any modern lisp or better with functional languages. Mapping and filtering is awkward. Arithmetic is awkward. Indexing and search strategies are not under programmer control. Modes are awkward. Cut and dynamic assert of global facts are abominations which undermine logical reasoning. Prolog programmers often write metacircular interpreters to fix these problems which is wonderfully easy but kills efficiency. The CLP examples aren't integrated with Prolog's Horn clause resolution model, they're just libraries with strange semantics. I've been an enthusiastic Prolog programmer since the mid 1980s, attended lots of conferences, read lots of papers, etc. There have been many promising attempts to fix these problems but they've only shown up as non-standard features in specific implementations. It's similar to the "curse of Lisp" - everyone does their own thing and no consensus emerges to move the standard forward. But it could be worse if the standard were "feature oriented" rather than eliminating the limitations and flaws by cleanly generalizing the model. I study new logic programming languages avidly hoping to see a worthy successor to Prolog. So far none quite make it. Mercury might do it if it got more love.

Re: The Simplicity of Prolog

#74

Earlier quoted context omitted.

That's the oldest complaint in the book about Prolog: "it's not 100% declarative". OK. So use Java. Or C. You think you'll have more declarative fun writing a Zebra Puzzle solver in C, than in Prolog? Be my guest. No, the truth is that Prolog is a unique language that is almost perfectly poised between the two extremes of beautiful but unusable formal purity and everyday programming utility. Prolog makes pragmatic ch…

my criticism cuts to the chase. that's why you write such a lengthy rebuttal. cause it hurts your feelings. > So use Java. Or C. You think you'll have more declarative fun writing a Zebra Puzzle solver in C, than in Prolog? and that, my dear friendo, is _whataboutism_!

[deleted]

Re: The Simplicity of Prolog

#75

I liked the authorization example. I've encountered Prolog articles before, but showing the code alongside an OOP implementation was a nice demonstration of its expressive power. As a follow-up, I'd love to learn how this auth system could be put into production. In this example, authorization rules are provided in the code (`user_role(mike, supervisor)`) and queried similarly. What if I wanted this system to expose…

https://github.com/Anniepoo/swiplwebtut/blob/master/web.adoc

Re: The Simplicity of Prolog

#76
post #55

Earlier quoted context omitted.

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…

> [...] might [...] might [...] might [...] might [...] might [...] All of what you say is true, and yet practical applications that did break are somehow not talked about quite as much as hypothetical applications that might have broken. SWI could reuse infix dot precisely because it was universally considered bad style to use it in the old style, and hence was not used in the old style. Which is not to say that I t…

I wish not every Prolog discussion had a top comment about Mercury, Curry, Minikanren, et al; but I think you missed the end of my comment where I recommended SWI over Scryer for most people; I am unashamedly a Markus Triska fanperson but that doesn't mean I do everything he does, or that I subscribe to ISO Purity over all else. It was more that the parent comment claimed a "friction between two people" and I think that's unfair and leaves readers expecting soap opera drama where someone insulted someone's mother; whereas it is a difference of opinion about language compatibility and standards - and once you know that you can decide whether it matters to you and your potential use cases (which, again, it doesn't to me and I think it doesn't to anyone who hasn't touched Prolog before).

I am not aware of any practical applications which have broken, but then I'm not aware of anyone using Prolog for anything, anywhere.

Re: The Simplicity of Prolog

#77
post #66

In 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…

You might want http://tau-prolog.org/documentation#js

Re: The Simplicity of Prolog

#79
post #68

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…

How does MiniKanren fix some limitations? MiniKanren corresponds to the purely relational subset of Prolog.

By allowing you to use the features of the host language to complement the features of miniKanren. Having good support for multiple programming paradigms is better than trying to make one paradigm fit all needs. Poplog[1] was an earlier attempt to provide such synergies but it failed to gain market share. It's now free software so take a look! The Racket ecosystem is another approach where each module can choose a language with some of them being Prolog-like[2]. [1] https://en.m.wikipedia.org/wiki/Poplog [2] https://racket-lang.org/languages.html

Re: The Simplicity of Prolog

#80
post #68

Earlier quoted context omitted.

How does MiniKanren fix some limitations? MiniKanren corresponds to the purely relational subset of Prolog.

By allowing you to use the features of the host language to complement the features of miniKanren. Having good support for multiple programming paradigms is better than trying to make one paradigm fit all needs. Poplog[1] was an earlier attempt to provide such synergies but it failed to gain market share. It's now free software so take a look! The Racket ecosystem is another approach where each module can choose a la…

Ok, but MiniKanren isn't intrinsic to Scheme. I agree Racket makes it especially easy to embed sub languages, but you could embed core relational Prolog just as well as MiniKanren. My understanding of your statement is that Scheme and MiniKanren share sexp syntax, but the same applies: you could embed an sexp-based Prolog just as well. The only remaining MiniKanren advantage is then to have a complete search strategy, this I concede.
Post reply on HN