The Power of Prolog
One of the coolest things I&#x27;ve seen is to use Prolog with CLP(FD) to solve the 7-11 problem. The problem basically says the sum of the prices of four items is $7.11, and the product is $7.11 too (no rounding); find the prices of these four items.<p>This can be solved in two lines of code that gives the (unique) solution in a second. Not even my expensive Mathematica can do this!<p><pre><code>    ?- use_module(library(clpfd)).
    true.
    
    ?- Vs = [A,B,C,D], Vs ins 1..711, A * B * C * D #= 711000000, A + B + C + D #= 711, A #&gt;= B, B #&gt;= C, C #&gt;= D, labeling([ff, down], Vs).
    Vs = [316, 150, 125, 120],
    A = 316,
    B = 150,
    C = 125,
    D = 120 ;
    false.
</code></pre>
Another great thing Prolog is good at is type inference. After all, type inference, in its simplest form, is just syntax-directed constraint generation and then using unification to solve constraints—exactly what Prolog gives you by default. You can write a type inference engine for simply typed lambda calculus in Prolog in 10 minutes. Google used to have a project to do type inference for Python written in Prolog, although they&#x27;ve since [switched away](<a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;pytype" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;pytype</a>).