Kind of offtopic, but does anyone know a good resource around implementing a simple prolog/similar language? My previous attempts at learning logic programming have failed, and it just _feels_ like a thing that becomes clear after you've seen how it works under the hood.
Ask HN: Production Prolog in 2020?
41–50 of 72 posts
Re: Ask HN: Production Prolog in 2020?
#42A tangeant question is: Which non-niche language are having push for integrating a subset of logic programming extensions ? There was a (unlikely to be merged at least in its current form) proposal for Kotlin -> https://github.com/Kotlin/KEEP/pull/199/files Maybe LINQ from .NET could be included There is also chalk from Rust https://github.com/rust-lang/chalk
Re: Ask HN: Production Prolog in 2020?
#43Earlier quoted context omitted.
I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.
In my experience, "logic wants to be code, and not data". Ie it's a dangerous (although sometimes necessary) step to move this into the data domain. Did you encounter any difficulties with missing source control, being able to use debugging tools, etc?
Highly regular logic is better expressed in generalizations, and inferable logic is better expressed in a compressed, normalized fashion rather than repeated and duplicated.
The more irregular logic becomes, the more it fights generalization and needs special cases. The ultimate special case is a programming language (and code is data too!). The risk in expressing rules in the form of data is that to handle all edge cases, you encode a custom programming language without all the resources that supports programming languages, like editors, debuggers, source control, developer mindshare, stack overflow, etc. But not all logic is irregular enough to warrant it.
Re: Ask HN: Production Prolog in 2020?
#44Re: Ask HN: Production Prolog in 2020?
#45Earlier quoted context omitted.
Do any of the non-artificial intelligences walking around out there contain a logical inference engine similar to Prolog?
Yes. Logic wasn't conjured up from abstract ideas, but from a concerted effort to distill the essence of what humans (regular, average people) find reasonable and convincing. (To mention just one example, there is a reason one of George Boole's major works is called "The Laws of Thought".) Our strategies for understanding language also involve inference and unification that is similar to logic programming. This is no…
Re: Ask HN: Production Prolog in 2020?
#46Re: Ask HN: Production Prolog in 2020?
#47A tangeant question is: Which non-niche language are having push for integrating a subset of logic programming extensions ? There was a (unlikely to be merged at least in its current form) proposal for Kotlin -> https://github.com/Kotlin/KEEP/pull/199/files Maybe LINQ from .NET could be included There is also chalk from Rust https://github.com/rust-lang/chalk
LINQ is just in-language SQL with type checks, unless I'm ignorant of a bunch of its functionality (which I really hope is true, now).
LINQ is extensible and you can connect it to arbitrary data sources by writing a query provider.
awesome-linq[0] has some examples of what can be done with it.
Re: Ask HN: Production Prolog in 2020?
#48Our pay software at work needs a Prolog engine (SWI). I think it's exactly where it shines : a complex logic with a lot of small rules that would be a nightmare to implement and maintain with a if / else logic.
I implemented something similar to that at a payments company a while back, but not with prolog because I couldn't get buy-in. I wrote a rules engine expressed as SQL tables, and it was absolutely better than if-else or switch. It let us delete thousands of lines of code and also slap on a UI so that the people managing the payments rules could make changes themselves. Highly recommend.
SQL is a deductive logic engine (same maths root as prolog IIRC, predicate calculus) but to bend it to work outside its domain, well the one time I tried it didn't work out so I'm extremely interested in what you did - TIA!
Re: Ask HN: Production Prolog in 2020?
#49Earlier quoted context omitted.
Do any of the non-artificial intelligences walking around out there contain a logical inference engine similar to Prolog?
> non-artificial intelligences walking around out there I'm not sure what you mean by this. Do you mean people? I don't think our 'inference engine' is much like Prolog, no.
--is what he means.
Re: Ask HN: Production Prolog in 2020?
#50Kind of offtopic, but does anyone know a good resource around implementing a simple prolog/similar language? My previous attempts at learning logic programming have failed, and it just _feels_ like a thing that becomes clear after you've seen how it works under the hood.
Slides: https://software.imdea.org/Conferences/CICLOPS2017/files/tar...
Paper: https://drops.dagstuhl.de/opus/volltexte/2018/8453/pdf/OASIc...
- - - -
The canonical method is teh WAM: https://en.wikipedia.org/wiki/Warren_Abstract_Machine