If I have the following database:
digit(0).
digit(1).
digit(2).
digit(3).
digit(4).
digit(5).
digit(6).
digit(7).
digit(8).
digit(9).
I want the query
digits([X,Y]).
to succeed by instantiating X and Y to 10*10 = 100 different combinations of digits, how would I go about this?
Would I need to use finite domain constraints for this and something like
L ins 0..9
Thank you in advance
you don't need clpfd to do that. You can use higher order to obtain an expressive solution:
digits(L) :- maplist(digit, L).
You can also do the recursion yourself:
digits([]) :- [].
digits([H|T]) :- digit(H), digits(T).