[m-rev.] for review: add string.format_table/2
Julien Fischer
juliensf at cs.mu.OZ.AU
Thu Feb 3 22:08:37 AEDT 2005
Some initial comments:
On Thu, 3 Feb 2005, Ian MacLarty wrote:
> Add a function to the string module to generate a formatted text table.
>
> library/string.m
> Add format_table/2 which generates a formatted text table from
> a list of columns.
>
> tests/general/string_test.exp
> tests/general/string_test.m
> Test the new function.
>
> Index: library/string.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/string.m,v
> retrieving revision 1.227
> diff -u -r1.227 string.m
> --- library/string.m 3 Feb 2005 09:06:36 -0000 1.227
> +++ library/string.m 3 Feb 2005 10:43:14 -0000
> @@ -667,6 +667,28 @@
> ; c(char).
>
> %-----------------------------------------------------------------------------%
> +
> +:- type justified_column
> + ---> left(list(string))
> + ; right(list(string)).
> +
> + % format_table(Columns, Seperator) = Table
> + % format_table/2 takes a list of columns and a column seperator
s/seperator/separator/
> + % and returns a formatted table, where each field in each column
> + % has been aligned and fields are seperated with Seperator.
s/Seperator/Separator/
> + % A newline character is inserted between each row.
> + %
What happens if the columns have different lengths?
More later,
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list