// //------------------ DOK FILE -------------------------------------------------- +Header core.util.table =pkg core.util.table =title core.util.table =short table pretty print =desc This small package contains only one function to display tables of strings. // // //------------------ PROTO ----------------------------------------------------- tablePrettyPrint +Proto tablePrettyPrint =type fun list array Str -> list array Str =mode function =pkg core.util.table =impl mcy =link =desc This function prints the content of data as a pretty format sql-like. The function goes through the list of arrays to first compute the max length of each column. Each array of the list is likely to have the same number of elements, however the function will run with arrays of various size. The function assumes that the first element of the list contains the name of the columns, and will add an horizontal separator before the second element. This can be avoided if the first element of data is nil. Each nil element of the list is ignored. > tablePrettyPrint ({"foo", "bar"}::{"abcdef", "ghij"}::nil) >| foo| bar| >|------|----| >|abcdef|ghij| >> tablePrettyPrint (nil::{"foo", "bar"}::{"abcdef", "ghij"}::nil) >| foo| bar| >|abcdef|ghij| // +arg data =type list array Str =desc A list of arrays of strings // +arg result =type list array Str =desc The same element