How can use data file with Eclipse-clp or Prolog program. for Variables and Array values. for example if you want to give data to program as an big Array.How can read this data from a data files?
Asked
Active
Viewed 119 times
2 Answers
0
ECLiPSe includes a CSV library:
http://eclipseclp.org/doc/bips/lib/csv/index.html
This library allows you to parse a CSV file into lists, which you can then convert into an array using another library:

Paulo Moura
- 18,373
- 3
- 23
- 33
-
very thanks , Then ECLipse does not read data file like MiniZinc? – ARZ Apr 22 '19 at 15:55
0
If you don't mind having your data in Prolog syntax, it is trivial. Just open a file and use read/2 to read it:
open(File, read, Stream), read(Stream, Data), close(Stream), ...
The file should then contain a single Prolog term, which can be of any valid Prolog type such as structure, list, array, number, string, and arbitrarily nested.

jschimpf
- 4,904
- 11
- 24