[ library(fd_global) | Reference Manual | Alphabetic Index ]

lexico_le(+List1, +List2)

List1 is lexicographically less or equal to List2
List1
List of integers or domain variables
List2
List of integers or domain variables

Description

Imposes a lexicographic ordering between the two lists. I.e. either is the first element of List1 strictly smaller than the first element of List2, or the first elements are equal and the lexicographic order holds between the two list tails.

Examples

    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]).		% X::0..2
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), X=2.	% Y::0..3
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), X#>2.	% fail
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), X#<2.	% true
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), Y=3.	% X::0..2
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), Y#>3.	% X::0..1
    L=[X, Y, Z], L :: 0..9, lexico_le(L, [2, 3, 1]), Y#<3.	% X::0..2
    lexico_le([2, 3, 1], [3]).					% true
    

See Also

ordered / 2