Qi (programming Language) - Qi Prolog

Qi Prolog

Qi Prolog is a version of Prolog implemented in Qi, using a standard Edinburgh syntax, embedding the Prolog program in a string. This is a basic example of Qi Prolog:

(m-prolog "dog(snoopy). man(socrates). man(plato). mortal(X) :- man(X).")

And this is how to ask questions to the Prolog database:

(prolog? (man plato)) (prolog? (man snoopy)) (prolog? (dog X)) (prolog? (man M))

Here is Einstein's Riddle in Qi Prolog. Under CMU Lisp on a 2.6 GHz Intel machine, Qi Prolog solves (ask ) in 0.24s (M = German) (300 KLIPS).

(m-prolog "einsteins_riddle(Fish_Owner) :- einstein(Houses, Fish_Owner). einstein(Houses, Fish_Owner) :- =(Houses, house, norwegian, _, _, _]), member(, Houses), member(, Houses), member(, Houses), iright(, Houses), member(, Houses), member(, Houses), member(, Houses), next_to(, Houses), member(, Houses), next_to(, Houses), next_to(, Houses), member(, Houses), member(, Houses), next_to(, Houses), member(, Houses). member(X,). member(X,) :- member(X,Z). next_to(X, Y, List) :- iright(X, Y, List). next_to(X, Y, List) :- iright(Y, X, List). iright(L, R, ]). iright(L, R, ) :- iright(L, R, Rest).")

Qi Prolog includes an interface for calling Qi functions and the possibility of mode declarations in a similar manner to DEC-10 Prolog.

Read more about this topic:  Qi (programming Language)