> This hashing is done in O(num of children), and then you get back a > HashConsed structure, that is shared for all hash consed instances > of the same tree. It can be used to test equality O(1), with > identical?, > and not O(size of the tree).
I've seen this referred to as interning -- indeed, that's what Java calls it for String: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#intern() I used this technique to save heap in a CL app I wrote once -- there could be 2 million entries containing URLs submitted by a client, and most of those URLs were the same. Interning the strings before insertion (just as you do, by jamming them into a hash-table) was a big benefit, and made subsequent comparisons cheaper, too. -R --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---