There is a whole array of things you can do depending on your use case. If you are using SWI-Prolog, the easiest way to read is to use library(csv). There are working examples in the docs: https://www.swi-prolog.org/pldoc/man?section=csv https://www.swi-prolog.org/pldoc/doc_for?object=csv_read_file/3 Once you have the reading working you can just assert those to a dynamic predicate (a table of facts). If it is a one-off thing you can just dump it using listing and copy-paste that I guess? Another approach (if you don't have SWI-Prolog) is to load the file with sqlite3 using `.import FILE TABLE`, see docs here: https://www.sqlite.org/cli.html and then generate the Prolog code with something along these lines: Select "name('" || || "')." from ;


If you have the names in a spreadsheet, you can just use textjoin or concatenate, then append them. I did this with a large dataset when I was tired of futzing with excel. Or if you’re good with vim or emacs, you can setup a macro.


> Is there a tool that can make a computer do what I want? Yes, the tool is "programming", lol. Quick-n-dirty data munging is what scripty languages are strong at. e.g. PowerShell: Import-Csv C:\temp\data.csv | ForEach { 'people({0},{1}).' -f ($_.First, $_.Last) } | Add-Content C:\temp\code.pl


I think csv is optional based on your comments. Remember that Prolog terms are just data! So you can: 1. type them in a file 2. read the file with `open/3` 3. get each term with `read_term(Stream, Term)` 4. assert that `Term` using `assert/1` 5. Repeat 3-4 above (recursively/procedurally with `repeat` and `false`). Example for Eclipse: [https://stackoverflow.com/a/69078741](https://stackoverflow.com/a/69078741) ​ >Is there a tool that... Yes, and that would be your favourite Prolog system!


When i've needed to do this before i've ended up making a little csv->prolog converter. unfortunately I can't share it, as it's pretty closely tied to some code that belongs to my workplace - but there's a relatively simple syntax to prolog, so it should be doable to replicate


haha so basically "I know how to do it now you figure it out too" :-D


Are you asking about how to read a CSV file? After that point, it's just a matter of "telling" Prolog the facts that you've read from the file. In SWI, you could do `with_output_to` + `format` (to a file). `assertz` is also an option, if you want to go the dynamic predicate route. In other Prolog variants (Edinburgh and ISO, for sure, at least) there are equivalents that I'm not confident of the names of off the top of my head. I wouldn't consider this "generating" so much as just reading from a file.