Reading a file and converting the input to integers...

From: Mark A. Hennessy <m.hennessy_at_4c.ucc.ie>
Date: Tue 19 Oct 2004 12:23:20 PM GMT
Message-ID: <41750738.7030007@4c.ucc.ie>
  Hi there,

    I am reading input from a file which consists of an N x N set of 
numbers.  I want to convert these number strings into integers which I 
use to represent the domains of variables I want to define for my 
problem. While I can easily convert a number string to an integer using 
number_string/2 I'm finding a problem with trying to convert the list of 
number strings I've created from the input file into a list of integers. 
I have tried to use a double foreach as follows

/Domains/ is defined as a list of number strings read in from a file: 
["1","2","3","4","5","6","7"...]

(foreach(Domain,Domains),
 foreach(D,NewDomainList) do
    number_string(NewDomain,D)
)

I thought this would allow me to build up a new list, /NewDomainList/ of 
integers that I could then use to define the domains of my variables. It 
does not work so I'm hoping someone who knows Eclipse better than I can 
help. I would prefer to continue to read the in file in the above format 
since this is the format the problem generator I'm using outputs.

Thanks in advance,
Mark.
Received on Tue Oct 19 13:28:57 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT