[eclipse-clp-users] A problem I am facing in Eclipse prolog

From: Yahya Mowiena <mowiena_at_gmail.com>
Date: Sun, 7 Jun 2009 06:07:09 +0300
Dear Eclipse-Prolog users

I am having a problem of getting a variable value out of the foreach loop
here's my code

(foreach(city_windArea{number_built: Ni}, WindACVars) do
        (foreach(Ni, List), param(Ni,List,Sum) do true),
         sum1(List, Sum)

).

%Cost $= 2000000 * Sum.



sum1(List, Sum):-
          (foreach(X,List),
              fromto(0, In, Out, Sum) do
                      Out $= In + X
          ).

I want to retrieve the sum calculated in the foreach loop to calculate the
cost but when I uncomment the cost function, an error appears

any help is highly appreciated

Thanks a lot
Best Regards

mowiena_at_gmail.com

-- 
Yahya Mowiena
Received on Sun Jun 07 2009 - 03:07:12 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET