6 ms·
Adventure in Prolog Tutorial (2016)
- xvilka 7y agoTwo more very good Prolog books: The Power of Prolog[1] and Simply Logical: Intelligent Reasoning by Example[2]. I also recommend visiting the Awesome Prolog list[3]. There is also a very interesting extension of the Prolog - Probabilistic Prolog, aka ProbLog[4]. And modern ISO-compatible implementation in Rust language - Scryer Prolog[5]. [1] https://github.com/triska/the-power-of-prolog/ https://github.com/triska/the-power-of-prolog/ [2] https://book.simply-logical.space/ https://book.simply-logical.space/ [3] https://github.com/klaussinani/awesome-prolog https://github.com/klaussinani/awesome-prolog [4] https://github.com/ML-KULeuven/problog https://github.com/ML-KULeuven/problog [5] https://github.com/mthom/scryer-prolog https://github.com/mthom/scryer-prolog
- rscho 7y agoScryer unfortunately seems to not be progressing very much. I really hope it takes off, though!
- segmondy 7y agoThis is a very good book for a first timer. This is one of the first books I read when learning Prolog. It's fun since you're building a game. Just work through it from front to cover and you will begin to get a good grasp on the language.
- carapace 7y agoYou know how when someone quits smoking and then, sometimes, they start to go around telling everyone else how great it is and how OMG! they should quit smoking too, and generally being a kind of smug and annoying about it? I had a kind of Prolog "conversion" experience last summer... You guys! Prolog is so great! OMG! You should really try it! I'm seriously you guys. In all seriousness, Prolog is a simple, powerful, elegant language, with a rich history replete with amazing research and tools. "An elegant weapon... for a more civilized age."
- ljm 7y agoI really want to build a thing or two with it, but my problem is that I’m too impatient to actually learn it first. I imagine you could build a pretty effective scheduling/booking system with it, for example, and without knowing better I would think that it’s less complicated than what you have to do to build that kind of thing imperatively. At the same time, I like declarative code and it makes me think of SQL. I’m pretty glad I picked that up before ORMs gave people a reason not to learn it. I would likely have that same impatience to learn SQL now, had I not.
- davelee 7y agoI've had this experience earlier this year. It's great, and I too mention it when I can. For me, it's often a nicer alternative in cases I might otherwise consider SQL in some way. My only complaint is aggregate functions are harder to use.
- criddell 7y agoI wrote some Prolog 25 years ago in school. As I recall we did a bunch of pattern matching stuff with it and at the time it never made much of an impression on me. I had similar experiences with CAML, SML, and COBOL. Scheme, C, and Pascal were the languages that clicked and had me writing stuff just for fun. What was it about Prolog that turned you into a fan?
- carapace 7y agoI was exposed to Prolog about 20 years ago. A friend of mine tried to teach it to me but it didn't "click". Looking back, I'm totally puzzled by that, I cannot explain why. Three things made me a fan: First, Markus Triska's "The Power of Prolog" came up here on HN, and I managed to learn enough make a nice solution to the Zebra Puzzle: https://gist.github.com/calroc/603ed919bc814ccee10c1b3df6142fec https://gist.github.com/calroc/603ed919bc814ccee10c1b3df6142... That got Prolog back on my radar. Second, I had just written a type-inferencer for a stack-based language called Joy[1], and had kind of realized that what I was doing whas Prolog-shaped. So I re-implemented the interpreter and inferencer both in Prolog and discovered that they were the same code. (So I deleted one copy.) https://hg.sr.ht/~sforman/Thun/browse/default/thun/thun.pl#L95 https://hg.sr.ht/~sforman/Thun/browse/default/thun/thun.pl#L... Joy-in-Prolog is ridiculously elegant. It's almost perverse. And then you can do messed-up things like partial evaluation: https://hg.sr.ht/~sforman/Thun/browse/default/thun/gnu-prolog/junk/partev.pl https://hg.sr.ht/~sforman/Thun/browse/default/thun/gnu-prolo... Then, third, "Logic Programming and Compiler Writing" by David Warren went by here on HN, almost exactly a year ago https://news.ycombinator.com/item?id=17674859 https://news.ycombinator.com/item?id=17674859 (It's a 404 now but you can find it elsewhere.) I found out that there's a wealth of research to draw on, and that it's really easy to make compilers and other tools in Prolog. It's so easy that, if you have to write a compiler from scratch it would be faster to learn Prolog and then use it to write your compiler than to (learn to) write a compiler in an imperative language you already knew! I was already interested in compiling Joy, and here was a short, broad path to the metal. (Here's my crude and incomplete first attempt: https://hg.sr.ht/~sforman/Thun/browse/default/thun/compiler.pl https://hg.sr.ht/~sforman/Thun/browse/default/thun/compiler.... ) Taken all together, I realized that something like half of my professional career was wasted simply due to ignoring Prolog for twenty years, and that everything I want to do going forward is both faster and easier in Prolog. (I have embedded Joy in it and can compile it...) [1] I wrote it up, "The Blissful Elegance of Typing Joy" http://joypy.osdn.io/notebooks/Types.html http://joypy.osdn.io/notebooks/Types.html
- norswap 7y agoFor a complete different approach: https://github.com/norswap/prolog-dry https://github.com/norswap/prolog-dry
- xvilka 7y agoYou can add your link to the Awesome Prolog list for a better visibility.
- segmondy 7y agoNot even comparable. The OP posted a book, but you posted is a guide of no more than 30 pages. Novice: Adventure in Prolog Learn Prolog Now Logic Programming with Prolog Med - Advanced: Clause and Effect The Art of Prolog The Craft of Prolog Wam Book The Practice of Prolog Prolog Programming for AI - Brakto Deep Dive: Expert Systems in Prolog Natural Language Processing for Prolog Programmers Intelligent Image Processing in Prolog Representing Knowledge In Prolog There are hundreds of books! The real gems are to be found in papers, look into published papers, you will find amazing topics on Meta Programming, Machine Learning, Compiler Construction, DCG, etc. Don't discount books by age, even if they were published in the 80s! The best books are from the 80's-90's. A few sites https://www.metalevel.at/ https://www.metalevel.at/ https://www.cpp.edu/~jrfisher/www/prolog_tutorial/contents.html https://www.cpp.edu/~jrfisher/www/prolog_tutorial/contents.h... Use SWI-Prolog - https://www.swi-prolog.org/ https://www.swi-prolog.org/
- 6thaccount2 7y agoThis is an awesome book. I had no idea it was free when I bought it lol. It is also the only book that made Prolog seem pretty simple and not super confusing. I just wish I had the kinds of problems where Prolog would be performant enough.
- pacaro 7y agoI love this book. I also think that everyone should build a theorem prover at some point, it's definitely an exercise in humilty
- aargh_aargh 7y agoWhat are some real-world, non-trivial programs written in Prolog? (with a short description, please)
- tempguy9999 7y agoDoes this help? https://duckduckgo.com/html?q=real-world%2C%20non-trivial%20programs%20written%20in%20Prolog https://duckduckgo.com/html?q=real-world%2C%20non-trivial%20...
- carapace 7y ago"Solving symbolic equations with PRESS" > We describe a program, PRESS, (PRolog Equation Solving System) for solving symbolic, transcendental, non-differential equations in one or more variables. PRESS solves autonomously, i.e. without guidance from the user. The methods used for solving equations are described, together with the service facilities. The principal technique, metal-level inference, appears to be relevant to the broader field of symbolic and algebraic manipulation. https://www.sciencedirect.com/science/article/pii/S0747717189800070 https://www.sciencedirect.com/science/article/pii/S074771718... https://github.com/maths/press https://github.com/maths/press
- noneeeed 7y agoThe first product I worked on after university was the theorem probing toolkit for the SPARK Ada statically analysable language. This is used to prove the absence of runtime exceptions. I really enjoy using Prolog, but the number of cases where I would choose to use it is pretty limited.
- LukeEF 7y agoWe are about to launch an prolog based DBMS. Incredibly powerful engine. Some prolog background here: https://medium.com/terminusdb https://medium.com/terminusdb Watch this space!
- carapace 7y agoI just read your "TerminusDB — what’s in a name?" blog post, love it! The tie-in to Asimov's Foundation, you folks seem pretty serious about that, yes? - - - - You're releasing TerminusDB under the GPL! Bless your hearts! I can't wait to see it! - - - - Did you know that the Applied Category Theory folks (https://www.appliedcategorytheory.org/ https://www.appliedcategorytheory.org/) have something they call CQL, Categorical Query Language, https://www.categoricaldata.net/ https://www.categoricaldata.net/ ? They have a book out that talks about it, "Seven Sketches in Compositionality:An Invitation to Applied Category Theory", specifically Chapter 3 "Databases: Categories, functors, and universal constructions" https://math.mit.edu/~dspivak/teaching/sp18/7Sketches.pdf https://math.mit.edu/~dspivak/teaching/sp18/7Sketches.pdf