In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
I don't think I ever learned how it can be useful other than feeding the mind.
11–20 of 251 posts
In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
I don't think I ever learned how it can be useful other than feeding the mind.
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.
Don't threaten me with a good time
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.
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)
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 ;-)
In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
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.