Re: [eclipse-clp-users] Scope of variable access

From: Wit Jakuczun <wit.jakuczun_at_gmail.com>
Date: Tue, 7 Oct 2008 21:31:45 +0200
2008/10/7  <behemot_at_alpha.pl>:
> Dear users!
>
> I've some variables and lists, which are initialized at the main (top) clause
> i.e at the beginning of a program.
>

> E.g.
> :- lib(ic),
> Bids_Prices = [4,3,5,4,7,9,8,11],
> Decisions = [D1,D2,D3,D4,D5,D6,D7,D8],
> Decisions::0..1.
>
> Then I have a few predicates, which should use earlier declared variables e.g.
> start:-
> (foreach(X,Decisions) do write(X)).

Add arguments to start:
start(Decisions):-
   (foreach(X,Decisions) do write(X)).

I suggest reading some good book on prolog.


Best regards
-- 
[ Wit Jakuczun  w.jakuczun_at_wlogsolutions.com ]
[ WLOG Solutions http://wlogsolutions.com   ]
Received on Tue Oct 07 2008 - 19:31:53 CEST

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