i was messing around a while back with this: http://code.google.com/p/jc-pheap/
the algorithms work, but it's probably in a between-state. I wasn't sure what the interface should look like exactly, and I was recently adding support for duplicate keys (but I wasn't sure if I should have two structures or one ... the latter being more of the multimap I'm describing). Oh, and I was starting to work on decreaseKey(), too ... but the runtime is still, likely amortized for that one. I actually had an idea that I'm not sure has ever been done before to make that operation even more baked. Fun stuff. The project does not depend on clojure, but shows clojure code as an example. If I recall, it all works. Hmmmm, maybe I'll get back into working on it and variations, tho. On Tue, Dec 15, 2009 at 5:16 AM, ataggart <alex.tagg...@gmail.com> wrote: > > > On Dec 15, 1:49 am, ataggart <alex.tagg...@gmail.com> wrote: > > On Dec 14, 5:48 am, Mark Tomko <mjt0...@gmail.com> wrote: > > > > > I wrote this implementation of a heap (or priority queue) in pure > > > Clojure: > > > > >http://pastebin.com/m2ab1ad5a > > > > > It's probably not of any quality sufficient to be make it to the > > > contrib package, but it seems to work. Any thoughts on how it might > > > be improved? > > > > > Thanks, > > > Mark > > > > Ideally such a collection would be usable with existing functions, > > e.g. pop, peek. To accomplish that you really need to implement > > against the expected java interfaces. > > > > I've been playing with the deftype/defprotocol stuff in the "new" > > branch, so I figured I'd try to apply that to this problem. This is > > what I came up with: > > > > http://gist.github.com/256815 > > To be clear, my implementation just uses a sorted list, not a true > heap tree. > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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