0

The simplest Prolog Quine, that can reproduces its own clause, reads as follows:

quine((quine(X) :- Y)) :-
    clause(quine(X), Y).

?- quine(Z).
Z =  (quine((quine(_22008):-_22004)):-clause(quine(_22008), _22004)).

Is there another Prolog Quine that doesn't use clause/2,
write/1, ..., i.e. dynamic database or input/output?

Can we write a Prolog program that searches such a Quine?

  • If you're willing to accept cyclic terms, maybe something like `quine(Z) :- Z = (quine(X) :- X = Z).`? – Isabelle Newbie Mar 05 '21 at 10:25
  • If I run it, I only get `?- quine(X). X = (quine(_2226):-_2226=X)`, the body does not reproduce., but the result should be `X = (quine(_1) :- _1 = (quine(_2) :- _2 = _1))` –  Mar 05 '21 at 11:11

0 Answers0