Re: Question about sorted-sets

2011-01-12 Thread Travis Treseder
> Yes that compareTo doesn't define a total order on your class. I think > you are missing a clause in cond: You're right on. I refactored the toCompare function to meet the requirements outlined in its javadoc, and it worked. I'm a little ashamed I didn't do that before wasting people's time...

Re: Question about sorted-sets

2011-01-11 Thread ka
Yes that compareTo doesn't define a total order on your class. I think you are missing a clause in cond: (cond (= sr sr2) 0 (= (.lik sr) (.lik s2)) return something based on quasi-isomorphic (> (.lik sr) (.lik sr2)) -1 :default 1) I think you should implement quasi-isomorphic as a

Re: Question about sorted-sets

2011-01-11 Thread Travis Treseder
> You should also try using a TreeSet and see if you get the same results as > with sorted-set. I get the same results with TreeSet. After looking at the javadocs more carefully, I realized the Comparator isn't implemented properly, namely, it's not doing this: The implementor must ensure sgn(x

Re: Question about sorted-sets

2011-01-11 Thread Travis Treseder
Stuart, > In order for this to work, the "quasi-isomorphic?" function has be reflexive. > Is it? (The .equals implementation is also missing a type test, but that > probably isn't > the problem here.) Yes, it is reflexive, and symmetric: user> (quasi-isomorphic? t2 t1) true user> (quasi-isomor

Re: Question about sorted-sets

2011-01-11 Thread Stuart Halloway
> All, > > I'm hoping another, wiser set of eyes can help me to see what I'm doing wrong. > > I've defined a deftype below that stores a likelihood and a tree structure > (nested vectors). The deftype overrides equals, etc, and implements > Comparable so I can add SearchResults to a sorted-set

Re: Question about sorted-sets

2011-01-11 Thread Travis Treseder
> My guess is that it's your likelihood function that's actually broken. > If sr1 and sr2 don't come out with the same likelihood, then in some > cases of putting them into the sorted set they'll never end up > compared with each other for equality. (Actually, I'd have thought in > all cases. Perha

Re: Question about sorted-sets

2011-01-10 Thread Ken Wesson
On Mon, Jan 10, 2011 at 10:23 PM, Travis Treseder wrote: > All, > I'm hoping another, wiser set of eyes can help me to see what I'm doing > wrong. > I've defined a deftype below that stores a likelihood and a tree structure > (nested vectors).  The deftype overrides equals, etc, and implements > C

Question about sorted-sets

2011-01-10 Thread Travis Treseder
All, I'm hoping another, wiser set of eyes can help me to see what I'm doing wrong. I've defined a deftype below that stores a likelihood and a tree structure (nested vectors). The deftype overrides equals, etc, and implements Comparable so I can add SearchResults to a sorted-set and sort by lik