Live data from Hacker News

Learn Prolog Now (2006)

lpn.swi-prolog.org

11–20 of 251 posts

Re: Learn Prolog Now (2006)

#11

In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought

I thoroughly enjoyed doing all the exercises. It was challenging and hence, fun!

I don't think I ever learned how it can be useful other than feeding the mind.

Re: Learn Prolog Now (2006)

#13

is prolog a use-case language or is it as versatile as python?

In theory, it's as versatile as Python et al[0] but if you're using it for, e.g., serving bog-standard static pages over HTTP, you're very much using an industrial power hammer to apply screws to glass - you can probably make it work but people will look at you funny. [0] Modulo that Python et al almost certainly have order(s) of magnitude more external libraries etc.

> you can probably make it work but people will look at you funny

Don't threaten me with a good time

Re: Learn Prolog Now (2006)

#14
post #7

is prolog a use-case language or is it as versatile as python?

Python wins out in the versatility conversation because of its ecosystem, I'm still kinda convinced that the language itself is mid. Prolog has many implementations and you don't have the same wealth of libraries, but yes, it's Turing complete and not of the "Turing tarpit" variety, you could reasonably write entire applications in SWI-Prolog.

Right, Python is usually the second-best choice for a language for any problem --- arguably the one thing it is best at is learning to program (in Python) --- it wins based on ease-of-learning/familiarity/widespread usage/library availability.

Re: Learn Prolog Now (2006)

#15

I've recently started modeling some of my domains/potential code designs in Prolog. I'm not that advanced. I don't really know Prolog that well. But even just using a couple basic prolog patterns to implement a working spec in the 'prolog way' is *unbelievably* useful for shipping really clean code designs to replace hoary old chestnut code. (prolog -> ruby)

I keep wishing for "regex for prolog", ie: being able to (in an arbitrary language) express some functional bits in "prolog-ish", and then be able to ask/query against it.

    let prologBlob = new ProLog()
    prologBlob.add( "a => b" ).add( "b => c" )
    prologBlob.query( "a == c?" ) == True
(not exactly that, but hopefully you get the gist)

There's so much stuff regarding constraints, access control, relationship queries that could be expressed "simply" in prolog and being able to extract out those interior buts for further use in your more traditional programming language would be really helpful! (...at least in my imagination ;-)

Re: Learn Prolog Now (2006)

#16
I remember writing a Prolog(ish) interpreter in Common Lisp in an 90's AI course in grad school for Theorem proving (which is essentially what Prolog is doing under the hood). Really foundational to my understanding of how declarative programming works. In an ideal world I would still be programming in Lisp and using Prolog tools.

Re: Learn Prolog Now (2006)

#17
Prolog really is such a fantastic system, if I can justify its usage then I won't hesitate to do so. Most of the time I'll call a language that I find to be powerful a "power tool", but that doesn't apply here. Prolog is beyond a power tool. A one-off bit of experimental tech built by the greatest minds of a forgotten generation. You'd it find deep in irradiated ruins of a dead city, buried far underground in a bunker easily missed. A supercomputer with the REPL's cursor flickering away in monochrome phosphor. It's sitting there, forgotten. Dutifully waiting for you to jack in.

Re: Learn Prolog Now (2006)

#18

In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought

I also found it mindbending.

But some parts, like e.g. the cut operator is something I've copied several times over for various things. A couple of prototype parser generators for example - allowing backtracking, but using a cut to indicate when backtracking is an error can be quite helpful.

Re: Learn Prolog Now (2006)

#19
I remember a project I did in undergrad with Prolog that would fit connecting parts of theoretical widgets together based on constraints about how different pieces could connect and it just worked instantly and it felt like magic because I had absolutely no clue how I would have coded that in Pascal or COBOL at that time. It blew my mind because the program was so simple.
Post reply on HN