I'm not very good at picat, but I'll try to help. Hmmm...
If I not lie, the Guide says: index notations can't be used in constraints..
But wait, I see the answer!
element(2,Y,8) constraint is true, if second element of a list Y equals to 8. But Z
can be equal to 8 or equal to every value in domain
at the same time(like something non-deterministic),
then solve() find this value and stop.
Why print() writes Z inside Y in the way you wrote it in the code? Probably, this behavior depends on inner implementation.
Perhaps, you forced the system to add a constraint into a list... and then print() just wrote it!
But if you use Y=[1,Z,3] , it interprets as list of domain variables.
So, Y become a domain variable itself with list values in domain, like [1,1,3], [1,5,3].. I don't know if that's right or not, but it nicely explains what's going on.
But that makes sense: Y only depends on Z. If Z instantiated, then Y too..
середа, 21 серпня 2024 р. о 23:53:11 UTC+3 C. G. пише: