0
b(X) :- a(b(X)).
c(X) :- a(c(X)).
d(X) :- a(d(X)).
etc.

I want to express it in a compact form:

F :- a(F).

However, this is a syntax error. What is the correct way to do this?

Sid Datta
  • 1,110
  • 2
  • 13
  • 29

1 Answers1

1

In plain ASP this is not possible. There is HEX where it is possible to use variables for predicates, however this will not directly make your program (or your idea) work.

To solve problems in practice, you can always add another layer of predicates around it (that is what HEX does internally):

true(F) :- true(a(F)).
peschü
  • 1,299
  • 12
  • 21
  • Will you please help me with https://stackoverflow.com/questions/51275421/clingo-asp-best-way-to-generate-characters-in-a-story-generator ? – Sid Datta Jul 11 '18 at 00:00