Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro
Normal file
16
Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
:- use_module(library(http/html_write)).
|
||||
|
||||
theader([]) --> []. theader([H|T]) --> html(th(H)), theader(T).
|
||||
trows([],_) --> []. trows([R|T], N) --> html(tr([td(N),\trow(R)])), { N1 is N + 1 }, trows(T, N1).
|
||||
trow([]) --> []. trow([E|T]) --> html(td(E)), trow(T).
|
||||
|
||||
table :-
|
||||
Header = ['X','Y','Z'],
|
||||
Rows = [
|
||||
[7055,5334,5795],
|
||||
[2895,3019,7747],
|
||||
[140,7607,8144],
|
||||
[7090,475,4140]
|
||||
],
|
||||
phrase(html(table([tr(\theader(Header)), \trows(Rows,1)])), Out, []),
|
||||
print_html(Out).
|
||||
Loading…
Add table
Add a link
Reference in a new issue