Clpfd: "not in" constraint


this is obviously a beginner question:
How to write a “not in” constraint to restrict a variable possible values by supplying a list of integers to exclude from the variable’s domain?


You can use the reification operator (#\)/1.
See also reification predicates here:

?- #\ X in 1..2.
X in inf..0\/3..sup.

Edit 14.11.2020:
Anther solution would be if the domain expressions would support all
bitwise operations, but this seems not to be the case:

?- X in \ 1..2.
ERROR: Domain error: `clpfd_domain' expected, found `\1..2'

Thanks a lot!