2 ms·
Good question. Pretty printing of any datum that can be bound to a symbol. I have numbers, strings, dicts (hash maps), arrays, lists, symbols and a few types of
by jonathanstrange 5y ago
Good question. Pretty printing of any datum that can be bound to a symbol. I have numbers, strings, dicts (hash maps), arrays, lists, symbols and a few types of values that are not externalizable. The current pretty printer lays out everything as code, i.e., an input like '(let ...) would be interpreted as let form and formatted accordingly.
But that's not the problem, I have troubles dealing with line-breaks. They are currently not intelligent enough, e.g. a list may break directly after an opening parenthesis even if the whole list would fit on the next line + indentation. It seems that a good pretty printer needs to look ahead?
Anyway, looking for a simple clean example. Just a function recursing into a list and formatting it as code with a fixed margin and without using any fancy formatting instructions would be very instructive.