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

From: Kish Shen <>
Date: Tue, 02 Oct 2012 20:37:41 +0100
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.


Received on Tue Oct 02 2012 - 19:37:53 CEST

This archive was generated by hypermail 2.2.0 : Wed Oct 03 2012 - 06:14:04 CEST