Re: [eclipse-clp-users] How to expand domain of a variable

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Sun, 06 Nov 2011 01:18:18 +0100
Sergey Dymchenko wrote:
> 
> [eclipse 1]: model([[10, 20], [15, 30], [40, 50]], Domain),
> query(Domain, 1, A1), query(Domain, 10, A2), query(Domain, 35, A3).
> 
> Domain = [10 .. 30, 40 .. 50]
> A1 = "No"
> A2 = "Yes"
> A3 = "No"
> Yes (0.00s cpu)

Hi Sergey,

you can achieve that simply via

?- X :: [10..20, 15..30, 40..50], is_in_domain(1, X, B1), is_in_domain(10, X, B2).
X = X{[10 .. 30, 40 .. 50]}
B1 = no
B2 = yes
Yes (0.00s cpu)


-- Joachim
Received on Sun Nov 06 2011 - 00:47:54 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST