Reputation: 363
i have some facts in prolog.I want to define a rule that would print data about all amino acids in a formated way. here is the link that i have facts and some rules that i have defined myself. but i can not get formatting work , i mean i don't want to use multiple write()'s and even the tab formatting i cant get to work. here is my some logic but its not working. I just want to generate a report like format. Here is the link and code that i tried http://swish.swi-prolog.org/p/aminnoo.pl
> aminoname(_,H,ShortName),
>
> write(H),
> write(ShortName),nl, /* write(ShortName),
>
> %display [Hydropathy value]
> %format:aminoclass('Ala','Hydropathy','hydrophobic').
> aminoclass(ShortName,'Hydropathy',HydropathyValue),
> write(HydropathyValue),
>
> %display [Volume]
> %format:aminoclass('Ala','Volume','very small').
> aminoclass(ShortName,'Volume',VolumeValue),
> write(VolumeValue),
>
> %display [chemical value
> %format:aminoclass('Ala','Chemical','aliphatic').
> aminoclass(ShortName,'Chemical',ChemicalValue), write(ChemicalValue),nl,
> listAminoAcidProperties(T).*/
> listAminoAcidProperties(T).
i want it in this format
+-----------------------------------------------------------------+
| name | age | color | something |
-------------------------------------------------------------------
| xyz | 56 | hgchc | var |
-------------------------------------------------------------------
i am using this code:
format('+~`-t~78|+ ~n', []),
format('|~tTable Title~t~78||~n', []),
format('+~`-t~78|+ ~n', []).
format('| ~s~t~28|| ~s~t~36|| ~s~t~56|| ~s~t~80||~n',
['Name', 'Age', 'Eye Colour', 'Phone Number']).
but it is notgiving output as defined above
Upvotes: 0
Views: 6033