Is there a way to turn this:
genre(blues).
gere(hiphop).
genre(rock).
Into something like this:
genre(blues;hiphop;rock).
*I know this does not work, but does something similar to this exist.
Is there a way to turn this:
genre(blues).
gere(hiphop).
genre(rock).
Into something like this:
genre(blues;hiphop;rock).
*I know this does not work, but does something similar to this exist.
You cannot consolidate facts, but you can turn them into a simple rule, like this:
genre(X) :- member(X, [blues, hiphop, rock]).
member/2
is a built-in list predicate in SWI to test list membership.
This lets you apply a predicate across all of the elements of a list, and will succeed only if all applications succeed.
test_list( _, [] ).
test_list( F, [H|T] ) :- P =.. [F,H], P, test_list( F, T ).
You could use this syntax
genre(X) :- X=blues ; X=hiphop ; X=rock.
but personally I advice the member/2 way...