Re: [eclipse-clp-users] Return one result

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Thu, 05 Nov 2009 11:20:11 +1100
Ismael München wrote:
> Hi,
>  
> How do I for return an answer in this example:
>  
> go(FirstRow) :-
>  dim(A, [2,2]),
>  A[1..2, 1..2] :: 1..100,
>  
>  dim(B, [2,2]),
>  B[1..2, 1..2] :: 1..100,
>  
>  (
>   for(I, 1, 2),
>   param(A, B)
>  do 
>   (
>    for(J, 1, 2),
>    param(A, B, I)
>   do
>    A[I,J] #=< B[I,J] * 2
>   )
>  ),
>  
>  sum(A[1,1..2], FirstRow).
>  
>  
> The results are in domain mode but I need one answer for each turn...

You need to add search.  Please see the tutorial chapter
http://eclipse-clp.org/doc/tutorial/tutorial053.html
and look at some of the examples at
http://eclipse-clp.org/examples/index.html


-- Joachim
Received on Thu Nov 05 2009 - 01:20:11 CET

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