Re: [racket-dev] union-find

2013-01-29 Thread Sam Tobin-Hochstadt
Yes, exactly. I meant that the strategy of just checking the canonical element would have the problem I described -- having an operation for that would fix it. Sam On Tue, Jan 29, 2013 at 7:57 PM, Robby Findler wrote: > I understood you to be asking for something like this: > > (check-equal?

Re: [racket-dev] union-find

2013-01-29 Thread Robby Findler
I understood you to be asking for something like this: (check-equal? (uf-same-set? (uf-new 1) (uf-new 2)) #f) (check-equal? (uf-same-set? (uf-new 1) (uf-new 1)) #f) (check-equal? (let ([a (uf-new 1)] [b (uf-new 1)]) (uf-union! a b) (u

Re: [racket-dev] union-find

2013-01-29 Thread Robby Findler
Thanks. That's a bug. uf-set-canonical! changes the canonical element of the set (without affecting the identity of the set). Robby On Tue, Jan 29, 2013 at 4:13 PM, Danny Yoo wrote: > On Tue, Jan 29, 2013 at 2:51 PM, Robby Findler > wrote: > > I've just pushed an implementation of the union-

Re: [racket-dev] union-find

2013-01-29 Thread Sam Tobin-Hochstadt
But wouldn't that equate two un-unioned invocations of (uf-new 1)? On Tue, Jan 29, 2013 at 7:47 PM, Robby Findler wrote: > But I should probably provide that, since it can be done more reliably > inside the library. > > Robby > > > On Tue, Jan 29, 2013 at 6:46 PM, Robby Findler > wrote: >> >> >>

Re: [racket-dev] union-find

2013-01-29 Thread Robby Findler
On Tue, Jan 29, 2013 at 4:23 PM, Danny Yoo wrote: > On Tue, Jan 29, 2013 at 2:51 PM, Robby Findler > wrote: > > I've just pushed an implementation of the union-find algorithm to the > data/ > > collection. I didn't do it quite the way wikipedia recommends, but > instead > > made the sets be litt

Re: [racket-dev] union-find

2013-01-29 Thread Robby Findler
But I should probably provide that, since it can be done more reliably inside the library. Robby On Tue, Jan 29, 2013 at 6:46 PM, Robby Findler wrote: > > > > On Tue, Jan 29, 2013 at 4:20 PM, Sam Tobin-Hochstadt wrote: > >> This is probably a silly question, but don't you also need some way to

Re: [racket-dev] union-find

2013-01-29 Thread Robby Findler
On Tue, Jan 29, 2013 at 4:20 PM, Sam Tobin-Hochstadt wrote: > This is probably a silly question, but don't you also need some way to > check if two sets have been unioned? Does your application not need > that? > > You check to see if their canonical element is the same. Robby > Sam > > On Tue

Re: [racket-dev] union-find

2013-01-29 Thread Danny Yoo
On Tue, Jan 29, 2013 at 2:51 PM, Robby Findler wrote: > I've just pushed an implementation of the union-find algorithm to the data/ > collection. I didn't do it quite the way wikipedia recommends, but instead > made the sets be little containers whose canonical element can be mutated. More code r

Re: [racket-dev] union-find

2013-01-29 Thread Sam Tobin-Hochstadt
This is probably a silly question, but don't you also need some way to check if two sets have been unioned? Does your application not need that? Sam On Tue, Jan 29, 2013 at 4:51 PM, Robby Findler wrote: > I've just pushed an implementation of the union-find algorithm to the data/ > collection.

Re: [racket-dev] union-find

2013-01-29 Thread Danny Yoo
On Tue, Jan 29, 2013 at 2:51 PM, Robby Findler wrote: > I've just pushed an implementation of the union-find algorithm to the data/ > collection. I didn't do it quite the way wikipedia recommends, but instead > made the sets be little containers whose canonical element can be mutated. Code review

[racket-dev] union-find

2013-01-29 Thread Robby Findler
I've just pushed an implementation of the union-find algorithm to the data/ collection. I didn't do it quite the way wikipedia recommends, but instead made the sets be little containers whose canonical element can be mutated. This suits my purposes well, but I wanted to ask if someone on the list