
1.4. FD Constraints 15
TOY(FD)> L == [X,1,2], domain [X] 1 2, count 1 L (#=) 2
yes
L == [ 1, 1, 2 ]
X == 1
Elapsed time: 0 ms.
exactly/3
• Type declaration:
exactly :: int → [int] → int → bool
• Definition: ’exactly X L N’ is true if X occurs exactly N times in the list L.
• Example at the TOY(FD) command level:
Next goal imposes that the two elements of a list have to be equal to 2.
TOY(FD)> L == [X,Y], domain L 1 2, exactly 2 L 2
yes
L == [ 2, 2 ]
X == 2
Y == 2
Elapsed time: 0 ms.
element/3
• Type declaration:
element :: int → [int] → int → bool
• Definition: ’element X L Y’ is true if the X-th element in the list L is Y (in the
sense of FD).
• Example at the TOY(FD) command level:
TOY> L == [X,Y,Z], domain L 1 10, element 2 L 7
yes
L == [ X, 7, Z ]
Y == 7
Z in 1..10
X in 1..10
Elapsed time: 0 ms.
serialized/2
serialized’/3
cumulative/4
cumulative/5
Kommentare zu diesen Handbüchern