3 ms·
Good point. Most programming languages have RegExp support. But very few (?) have Prolog support. That might be useful in some or many cases, like ...
by galaxyLogic 4y ago
Good point. Most programming languages have RegExp support. But very few (?) have Prolog support. That might be useful in some or many cases, like ...
- bandrami 4y agoThe pattern matching capability in the ML family is arguably an embedded Prolog system.
- felixyz 4y agoIt might partially have been inspired by Prolog, in fact. But it lacks backtracking and unification so I don't think it qualifies as an embedded Prolog system. Erlang allows so-called non-linear patterns (ie using the same variable for several argument positions, implying equality), which comes slightly closer to Prolog (and of course, Erlang was originally modeled on Prolog, but the apple ended up far from the tree).
- gnulinux 4y agoAt compile-time, sure. But ML-like languages in general have no support for runtime logical programming. They don't provide an API to do things like type inference at runtime. For a good reason too, the only possible way type inference in ML-like languages work is because the computational cost is abstracted away from the runtime. Logical programming (ala Prolog) is very useful but the truth is it's asymptotically inefficient. Standard ML's type inference algorithm was, for example, asymptotically exponential. It just so happened that for useful programs it halts in a reasonable amount of time. This is not something you can provide an API for so that at runtime you can run arbitrary type inferences.
- mechanicum 4y agoIt’s not Prolog, but the related miniKanren has been widely implemented.
- varranvar 4y agominiKanren is not nearly as efficient as Prolog though.
- galaxyLogic 4y agoI understand that Prolog is good for creating parsers, right? Then could it to a large extent be a replacement for RegExps, providing more powerful ways to do string-manipulation.