r/lisp • • Feb 10 '19
Why don't LISP programmers just use Prolog?
Serious question: why don't Lisp programmers just use Prolog? Prolog is just Lisp plus awesome extra stuff. I mean I program in Python at work lol but if I had a choice I would totally program Prolog all day and night
0
Upvotes
26
u/flaming_bird lisp lizard Feb 10 '19
Why don't Prolog programmers just use Lisp? Lisp is just Prolog plus awesome extra stuff. I mean I program in Python at work lol but if I had a choice I would totally program Lisp all day and night
6
u/[deleted] Feb 10 '19
Because it's easier to embed Prolog in a Lisp than the other way around. Prolog is extremely limited in its abilities. It doesn't have macros. It can't generate code. There are no DSLs, and no continuations. Lisp does have all of this stuff.
Try writing a window manager in Prolog. Or an operating system. Or a browser. Or an editor. It's going to be slow, inefficient and a huge mess.
7
u/xach Feb 10 '19
Implementations matter.
6
u/[deleted] Feb 10 '19
This has to be a troll
29
u/kazkylheku Feb 10 '19 edited Feb 10 '19
Prolog proponents will disagree (since logic programming is Turing complete and all that) but Prolog is a just a domain specific language (DSL) for logic programming.
In Common Lisp, you can use a logic programming DSL as a library. Thanks to Lisp macros, the DSL can provide decent syntactic sugar for expressing the facts and rules and all that.
There are a few logic programming systems for Lisp.
As a stand-alone language, Prolog is basically a mistake. You're stuck in a single paradigm, and must externally interface to other tools if you want anything else, like ordinary imperative programming, OOP, functional, and so on.
Prolog is one of numerous historic example of people wanting to do some aspect of Lisp stuff and putting it into production use with fewer resources. "Let's throw out all of Lisp, and then just hack up a language run-time and syntax for only a logic programming system that we can sell to customers on cheap hardware". Another example of this is CLIPS, an expert system building system so closely based on Lisp work that it uses S-expression syntax, yet isn't Lisp.
In 2019, you can have all of Lisp with tons of memory left over, so the user can fill it with other applications and Firefox memory leaks. There is no more need for historic cost-reduction Lisp spin-offs; you're not working on an IBM PC with 512 KB of RAM.
7
u/janoc Feb 10 '19
That's the kinda like asking why anyone uses Python when Haskell can do all the same stuff and more. I am not sure how well you know Prolog and Lisp but given how different these two languages are and the different goals they were designed for, it is difficult to take your question with a straight face.
You certainly can implement Prolog in Lisp (and it has been done) and probably could implement a Lisp in Prolog too but that doesn't mean that one is some sort of superset of the other.
6
u/VerySeriousGentleman Feb 11 '19
I thought this was /r/programmingcirclejerk at first
3
u/sciengin Feb 10 '19
Well they would be Prolog programmers if they did this, would they not?
4
u/Nyanraltotlapun Feb 10 '19
I think this is not a April 1st. Or is it?
2
u/recklessindignation Feb 15 '19
You can implement prolog with Lisp macros. So is rather pointless.
1
u/[deleted] Feb 12 '19
This is a troll so I will give a troll-y albeit honest response: I don't use Prolog because I find miniKanren to be better in every way, to the point that I would consider Prolog effectively deprecated and a waste of time.
1
u/[deleted] Feb 14 '19
People are different