I'm using Sicstus Prolog, and I'm trying to solve the Domino Puzzle.
I have a list with triplets, which I need to set the domain of. I know how to set the domain of a single variable, or a list of single variables, but how can I do it if my list has triplets, and each of the elements of the triples has a different domain?
DV = [R1-C1-D1, R2-C2-D2, ... , R15-C15-D15]
What I want to do is this:
domain(R1, 1, 4)
domain(C1, 1, 4)
domain(D1, 0, 1)
domain(R2, 1, 4)
domain(C2, 1, 4)
domain(D2, 0, 1)
....
domain(R15, 1, 4)
domain(C15, 1, 4)
domain(D15, 0, 1)
How can I do this without having to explicitly state each of the variables?
Describe the domains for one element:
And:
using
library(maplist)
.Alternatively, using
library(lambda)
: