This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let max_widths header rows = | |
let lengths l = List.map ~f:String.length l in | |
List.fold rows | |
~init:(lengths header) | |
~f:(fun acc row -> List.map2_exn ~f:Int.max acc (lengths row));; | |
let render_separator padding widths = | |
let pieces = List.map widths | |
~f:(fun w -> String.make (w + 2 * padding) '-') | |
in |