Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -2,21 +2,21 @@ test :- augment('test.csv', 'test.out.csv').
|
|||
|
||||
% augment( +InFileName, +OutFileName)
|
||||
augment(InFile, OutFile) :-
|
||||
open(OutFile, write, OutStream),
|
||||
( ( csv_read_file_row(InFile, Row, [line(Line)]),
|
||||
% Row is of the form row( Item1, Item2, ....).
|
||||
addrow(Row, Out),
|
||||
csv_write_stream(OutStream, [Out], []),
|
||||
fail
|
||||
)
|
||||
; close(OutStream)
|
||||
).
|
||||
open(OutFile, write, OutStream),
|
||||
( ( csv_read_file_row(InFile, Row, [line(Line)]),
|
||||
% Row is of the form row( Item1, Item2, ....).
|
||||
addrow(Row, Out),
|
||||
csv_write_stream(OutStream, [Out], []),
|
||||
fail
|
||||
)
|
||||
; close(OutStream)
|
||||
).
|
||||
|
||||
% If the first item in a row is an integer, then append the sum;
|
||||
% otherwise append 'SUM':
|
||||
addrow( Term, NewTerm ) :-
|
||||
Term =.. [F | List],
|
||||
List = [X|_],
|
||||
(integer(X) -> sum_list(List, Sum) ; Sum = 'SUM'),
|
||||
append(List, [Sum], NewList),
|
||||
NewTerm =.. [F | NewList].
|
||||
Term =.. [F | List],
|
||||
List = [X|_],
|
||||
(integer(X) -> sum_list(List, Sum) ; Sum = 'SUM'),
|
||||
append(List, [Sum], NewList),
|
||||
NewTerm =.. [F | NewList].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue