Re: [eclipse-clp-users] my_indomain

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Wed, 07 Jan 2009 17:44:27 +0100
Daniel Riera wrote:
> Hello everybody,
> 
> I was wondering if there is an easy way to do the following:
> 
> Given a variable X, and its domain {1..10}, if I want it to be labelled
> in a certain order, for instance, [3,6,4,5,8,7,9,10,1,2], what is the
> best way to do it?

Hi Daniel,

I usually do as follows:

Y :: 1..10, element(Y,[3,6,4,5,8,7,9,10,1,2],X),indomain(Y).

I don't know if it's the best way to do it, but it is quite simple.

Cheers,
Marco
-- 
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel  +39-0532-97-4833
Fax  +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Wed Jan 07 2009 - 17:08:43 CET

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