First, this: (foreach(_,Countries), for(_,1,N) do true), is just a complicated way of saying: length(Countries, N), The source of out of range error is that Countries is a list in your code, but you try to access with indexes as an array. To fix you can just change the first line of your code making Countries an array: dim(Countries, [N]), Sergii. On Fri, Aug 16, 2013 at 4:13 PM, Volkan Unsal <spocksplanet_at_...6...>wrote: > Hey all, > > It's me again. Sorry about the noob questions I've been throwing at this > lately. This one has to do with the following code: > > %% Create a list of variables for Countries > (foreach(_,Countries), for(_,1,N) do true), > %% Set up the domain of the Countries, which would in fact be the colors > Countries :: 1..N, > %% Set up inequality constraints between the nodes in edges > (foreach([N1, N2],Edges), param(Countries) do > I is N1 + 1, > J is N2 + 1, > Countries[I] #\= Countries[J] > ). > > Basically I am generating a list of N variables where N is 100, and then > trying to create an inequality between them for each edge. Just the basic > coloring problem. However, I've been getting out of range error from the > program: > > out of range in arg(5, [_161745{[1 .. 100]}, _161766{[1 .. 100]}, > _161787{[1 .. 100]}, _161808{[1 .. 100]}, _161829{[1 .. 100]}, _161850{[1 > .. 100]}, _161871{[1 .. 100]}, _161892{[1 .. 100]}, _161913{[1 .. 100]}, > _161934{[1 .. 100]}, _161955{[1 .. 100]}, _161976{[1 .. 100]}, _161997{[1 > .. 100]}, _162018{[1 .. 100]}, _162039{[1 .. 100]}, _162060{[... .. ...]}, > _162081{[...]}, _162102{...}, ...], _163873) > > Not sure why it is unable to access the fifth element in this list since > it has 100 items in it. > > > Volkan > > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite! > It's a free troubleshooting tool designed for production. > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECLiPSe-CLP-Users_at_lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > >Received on Fri Aug 16 2013 - 23:30:27 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST