Re: Hash Consing

2009-06-29 Thread Richard Newman
> 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 -- indee

Re: Hash Consing

2009-06-29 Thread Nicolas Oury
> > I don't know anything about hash consing. Based on my > limited understanding of the description I am just wondering > if this is different from structural sharing that Clojure collections > have. The sharing only concerns data structure having the same creation point. As Achim explained,

Re: Hash Consing

2009-06-29 Thread Achim Passen
Hi! I think it’s basically a generalized version of this: user> (def hcons (memoize cons)) #'user/hcons user> (identical? (cons 1 nil) (cons 1 nil)) false user> (identical? (hcons 1 nil) (hcons 1 nil)) true In the case of cons, every two equal (value-wise) data structes have the same "construc

Re: Hash Consing

2009-06-29 Thread Laurent PETIT
Hi, I'm interested in knowing how you solve garbage collection issues ? 2009/6/29 Nicolas Oury : > > Dear all, > > I am coding a (very) small hash consing library for clojure. > > For those we don't happen to know what hash consing is, it is a way of > allowing equal data structures to be share

Re: Hash Consing

2009-06-29 Thread Sean Devlin
I'm pretty sure Clojure already does this, because of the built in equality by value. I'm pretty sure the hash keys work of off the value, too. Do you have any code you could post to github or something? That would help us determine if such a thing already exisits. I know this doesn't save you

Re: Hash Consing

2009-06-29 Thread Parth
On Jun 29, 3:09 pm, Nicolas Oury wrote: > Dear all, > > I am coding a (very) small hash consing library for clojure. > > For those we don't happen to know what hash consing is, it is a way of > allowing equal data structures to be shared in memory. > This leverages the purity (as in "immutabili