4 ms·
> Everybody who does PL theory more seriously probably knows that, but I didn't realize how close type inference and prolog-like systems look. Yup! This is mor
by bjz_ 10y ago
> Everybody who does PL theory more seriously probably knows that, but I didn't realize how close type inference and prolog-like systems look.
Yup! This is more to do with a very specific part of type theory - ie. 'type reconstruction' (more commonly referred to as 'type inference'). One of the most notable examples of this is the so-called 'Hindley-Milner type system' which can be proven to decidable. Here is a good explanation of the constraint-solving algorithm: http://jozefg.bitbucket.org/posts/2015-02-28-type-inference.html http://jozefg.bitbucket.org/posts/2015-02-28-type-inference....
- malisper 10y agoAlgorithm W, the algorithm used to do type inference in Hindley Milner is effectively just unification (the process by which Prolog infers facts, as mentioned in the post you referenced), applied to types.
- bjz_ 10y agoYeah - should have been more clear on that ;)
- baq 10y agoI've looked at Prolog for implementing a rule-based workflow system, but I find that it's very hard to embed eg. SWI Prolog into Python, in which the rest of the project is written. Does anyone know of an embeddable Prolog, preferably open source?
- YeGoblynQueenne 10y agoSwi Prolog has an interface to python, pyswip: https://code.google.com/archive/p/pyswip/ https://code.google.com/archive/p/pyswip/ It's a bit unstable but if you really, really want to embed Swi Prolog it's available as a .dll - which is how pyswip and all other foreign language interfaces work.
- junke 10y agoECLiPSe, for example. See [1] for documentation about how to embed it. However, this is targetted at C, Java and Tcl/Tk, not Python. Another approach is to use a client/server approach with two processes (python starts a background prolog, for example). [1] http://eclipseclp.org/doc/embedding/embroot.html http://eclipseclp.org/doc/embedding/embroot.html
- sitkack 10y agoCould you abstract it out as a network service?