Re: [eclipse-clp-users] labeling question with ic and eplex

From: Kostas Oikonomou <ko_at_research.att.com>
Date: Tue, 02 Oct 2012 17:01:40 -0400
Kish,

Thanks for the clarification, that solves my problem.

I looked for a while, but I haven't been able to find where 
in the documentation X[n..m] is actually explained.

                                 Kostas

On 10/ 2/12 03:37 PM, Kish Shen wrote:
> On 02/10/2012 18:45, Kostas Oikonomou wrote:
>
>> The only difference between hyb1 and hyb2 is that X is a
>> single variable in hyb1 but a 2-element array in hyb2.
>> I don't understand why or how the array is treated
>> differently.  And is there a way around this issue?
>
> > ic:search([X[1..2]],0,input_order,indomain,complete,[])
>
> Why do you have X[1..2] inside a list? Remember that 
> X[1..2] is actually parsed to subscript(X, [1..2]), so 
> what you have is
>
> ic:search([subscript(X, [1..2])], ...)
>
> and subscript/2 requires explicit handling (by calling 
> subscript/3) to convert it to the list of array elements 
> you expect, otherwise subscript/2 is just treated as a 
> structure.
>
> In your case, search/6 expects the first argument to be a 
> collection,
> including array "expressions" like X[1..2], so
>
> ic:search(X[1..2], ...)
>
> should work, but search/6 does not expect a list of 
> collections in the first argument, which is what [X[1..2]] 
> is, and so does not parse this correctly, i.e. it leaves 
> X[1..2] as it is, as subscript(X, [1..2]) and this is an 
> invalid argument for indomain/1.
>
> Cheers,
>
> Kish
>
>
>
Received on Tue Oct 02 2012 - 21:01:48 CEST

This archive was generated by hypermail 2.2.0 : Thu Oct 04 2012 - 06:13:49 CEST