Re: [PATCH] Implement `equal' for hash tables
Stéphane Marks <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <CAN+1HbrPMQ01YLJZ1JuhvoJG2YNCyqoiVyv+WaPv3jgSgRz23w@mail.gmail.com> |
On Sun, Aug 16, 2026 at 6:13 AM Sean Whitton <[email protected]> wrote: > Björn A. Lindqvist [14/Aug 9:27pm +02] wrote: > > On 8/14/26 13:13, Sean Whitton wrote: > >> I think we'd really like to see examples. I don't think I have ever > >> done it so I have a hard time believing "extremely" > > > > Suppose you have same JSON configuration. The most natural > > representation of it is a list of hash tables that contain nested hash > > tables and lists. You perform some expensive operation only if the > > configuration changes: > > > > (when (not (equal old-config new-config)) > > (expensive-op)) > > > > The configuration may be a parse tree, key-value store, or any other > > kind of database for which nested hash tables is a convenient > > representation. > > Oh, interesting example, thanks. > If hash table insertion order matters, then the equal operation would need an argument to compare (nested) hash tables in an order-insensitive way. I believe the Java Jackson package's equal operation ignores element order. It's been a while in Python but IIRC, one has to perform key sorting shenanigans to compare json documents parsed into a dictionary. And then there are the data type comparator issues where two json documents might be "human equal" but not technically equal; the most common thing I've seen is that json has no standards for dates and times so it's a mess +/- your level of control over the json documents.