c-cube / printbox

print nested boxes, lists, arrays, tables in several formats
https://c-cube.github.io/printbox/
BSD 2-Clause "Simplified" License
75 stars 9 forks source link

DAG solution by pre-processing of ID-annotated `Simple.t` #27

Closed lukstafi closed 1 year ago

lukstafi commented 1 year ago

See issue #25. Implements a poor-man's support for DAGs, where the caller annotates potentially-shared subtrees with IDs. Then, PrintBox.Simple eliminates shared subtrees by replacing them with just the [ID] text. Also implements a conversion to represent expression trees more compactly.

lukstafi commented 1 year ago

Change of behavior: the conversion from PrintBox.Simple.t to PrintBox.t introduces centered alignment for the top cell of any two-cell h-list.

lukstafi commented 1 year ago

Sorry, I opened this PR too early. I'm rewriting it to handle sharing.

lukstafi commented 1 year ago

This solution adds noise to the library but provides little value. The better approach would be to work out a proper layout mechanism.