Perhaps because you are still using a bad comparison function when constructing 
the sorted-set?

(see reply on other thread)

That said, Mark's suggestion of a using a priority queue is also a good one.

Andy

On Nov 20, 2012, at 9:57 AM, JvJ wrote:

> I actually did try that, but somehow disj wasn't working properly.
> 
> user> (def test-set (sorted-set-by msinterview/d-comp [:A [[:A] 0]] [:B [[:A 
> :B] 10]]))
> #'user/test-set
> user> test-set
> #{[:A [[:A] 0]] [:B [[:A :B] 10]]}
> user> (disj test-set (first test-set))
> #{[:A [[:A] 0]] [:B [[:A :B] 10]]}
> 
> On Tuesday, 20 November 2012 12:50:21 UTC-5, Andy Fingerhut wrote:
> Have you tried using first to get the smallest item from the set, and then 
> create a new sorted set with the item remove by using (disj my-sorted-set 
> item) ? 
> 
> Andy 
> 
> On Nov 20, 2012, at 9:46 AM, JvJ wrote: 
> 
> > I've just implemented Dijkstra's algorithm, and as far as I can tell, it 
> > works. 
> > 
> > However, I'm a little concerned at the efficiency.  Specifically, I am 
> > using sorted sets, and I can't break apart the set into first/next and keep 
> > it as a set.  I have to get next as a sequence and then apply sorted-set-by 
> > to that sequence.  This seems like a lot of wasted time.  Is there a better 
> > way, or is it not a problem? 


-- 
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

Reply via email to