Hello again, Let me put in details what I'm trying to do regarding file reading: I'm reading two files that contains input data of my problem. I could find on the docs that I could use something like: :-mode read_data(++,-). read_data(File,Result):- open(File,read,S), read(S,X), read_data_lp(S,X,Result), close(S). read_data_lp(_S,end_of_file,[]):- !. read_data_lp(S,X,[X|R]):- read(S,Y), read_data_lp(S,Y,R). and my program would get the input data from the input files and create a matrix based on the number of itens, like: linear2(M,MinWaste,Pieces,Bars):- read_data('C:\\Users\\data\\itens.txt',Pieces), read_data('C:\\Users\\data\\barras.txt',Bars), linear(Pieces, Bars, M, MinWaste). linear(PieceLengths, BarsLengths, M, MinWaste) :- dim(PieceLengths, [NPieces]), dim(BarsLengths, [NBars]), dim(M,[NPieces,NBars]), . . . The thing is that the "dim" predicate is exiting unexpectedly and the program stops. I suppose the read_file is not actually returning an array of values that dim predicate can use. Looking at the tracer I couldn't reach a conclusion. What is going wrong here? Thanks for any assistance, Igor.Received on Fri Nov 13 2009 - 02:25:14 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET