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

From: Sergey Dymchenko <kit1980_at_...6...>
Date: Sun, 6 Nov 2011 03:00:02 +0200
Thank you, but the main question how to construct that domain X ::
[10..20, 15..30, 40..50] if I have a list of interval boundaries [[10,
20], [15, 30], [40, 50]] (I read them from a file, number of intervals
can be different).
I can't see how do this simpler than in my model/2

Sergey.

On Sun, Nov 6, 2011 at 2:18 AM, Joachim Schimpf <jschimpf_at_...311...> wrote:
> 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
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
Received on Sun Nov 06 2011 - 01:00:09 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST