This library parses and generates CSV data. CSV data is represented in Prolog as a list of rows. Each row is a compound term, where all rows have the same name and arity.
Suppose we want to create a predicate table/6 from a CSV file that we know contains 6 fields per record. This can be done using the code below. Without the option arity(6), this would generate a predicate table/N, where N is the number of fields per record in the data.
?- csv_read_file(File, Rows, [functor(table), arity(6)]), maplist(assert, Rows).
//
//
separator(0';)
.
true
(default false
), strip leading and
trailing blank-space. RFC4180 says that blank space is part of the data.
true
(Default), use name/2
on the field-data. This translates the field into a number if possible.
row
.