ruricolist / serapeum

Utilities beyond Alexandria
MIT License
425 stars 42 forks source link

Pretty-print hash-tables #76

Closed vindarel closed 3 years ago

vindarel commented 3 years ago

fixes #75

Given that I reverted my changes from the issue snippet, that made it work more nicely in a readline REPL, this is a straightforward adaptation from RUTILS (3-clause MIT). Thanks, Rutils!

ruricolist commented 3 years ago

I merged this with two changes:

  1. I didn't like having a variable to control the pretty printing, I would rather the user call (toggle-pretty-print-hash-table) directly.
  2. I changed toggle-pretty-print-hash-table to use set-pprint-dispatch instead of evaluating a defmethod. I think this way is cleaner.
vindarel commented 3 years ago

@vseloved you might be interested by set-pprint-dispatch instead of using defmethod for pretty-printing hash-tables. Best,