Advertisement
logicmoo

CSV Maybe

Dec 21st, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.43 KB | None | 0 0
  1. write_table(Cells, Data) :-
  2.     (var(Data)
  3.     ; var(Cells)),
  4.     write('Data source not instantiated. \n').
  5.  
  6. write_table(Cells, [H|Rest]) :-
  7.     write(H),
  8.     Remain is Cells - 1,
  9.     write_table(Cells, Remain, Rest).
  10.  
  11. write_table(Cells, Remain, [H|Rest]) :-
  12.     Remain < 1 ->  
  13.     ( nl,  
  14.       write_table(Cells, [H|Rest]))
  15.     ;  (write(', '),
  16.        write(H),
  17.        RemainM1 is Remain - 1,
  18.        write_table(Cells, RemainM1, Rest)).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement