On Sunday, September 13, 2020 at 12:41:15 AM UTC+2 hen...@topoi.pooq.com wrote:
> True, but that would require rewriting list, and quasiquote, ans > others like that to use the hashcons. > > Not impossible. > One potentially useful trick is to write a function `canonicalize` which deeply traverses the structure of its argument, rebuilding it if necessary to produce the canonical representative for each piece of substructure. Then you can `(canonicalize (map f xs))` without having to rewrite `map`, and it takes (asymptotically) the same time as it would if you did alter `map`. Another thing to watch out for is that hashconsing via `equal?` can be quite expensive for things like hash tables. I used hashconsing extensively in the first implementation of Syndicate and ended up having to implement my own treaps to get good asymptotic performance with a hashconsed dictionary structure. Cheers, Tony -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/8de04262-e1c3-44b4-83a0-1a0c637e3f47n%40googlegroups.com.