User talk:GordonBGood: Difference between revisions

Content added Content deleted
(add link to ZIP file.)
(comments on PriorityQ)
Line 19: Line 19:
====Priority queue implementation====
====Priority queue implementation====
In case [https://wiki.haskell.org/Prime_numbers#External_links you missed it], you can see exactly what PQ implementation was used in the article, in http://www.cs.hmc.edu/~oneill/code/haskell-primes.zip. Also, the code in the ZIP is optimized compared to the article, using "hybrid queue" for the second feed, IIRC. [[User:WillNess|WillNess]] ([[User talk:WillNess|talk]]) 10:43, 30 April 2015 (UTC)
In case [https://wiki.haskell.org/Prime_numbers#External_links you missed it], you can see exactly what PQ implementation was used in the article, in http://www.cs.hmc.edu/~oneill/code/haskell-primes.zip. Also, the code in the ZIP is optimized compared to the article, using "hybrid queue" for the second feed, IIRC. [[User:WillNess|WillNess]] ([[User talk:WillNess|talk]]) 10:43, 30 April 2015 (UTC)

: Thanks for the link, Will. I had found the implementation of the PriorityQ, including the HybridQ in one of your ideone entries, but not the original source for "PriorityQ.hs"; BTW, I had seen the minor slip-up in the implementation of PriorityQ (forgetting to reverse the order of the left and right branches in one place), which would only affect deletions as the original algorithm does not use and therefore would not affect its primes generation. My improved entry does not use HybridQ as it seems to be an alternate method of compensating for the over-eagerness of adding primes, nor do I use the SPECIALIZE'ations to compensate for the various numeric ranges required, as the method as you use in your second "Unbounded" entry seems so much cleaner. My entry uses some fusion to avoid list processing, but there are likely other optimizations that could be used; my point is not really that this is the fastest way to implement a Priority Queue version but to show that it is relatively clean and easy to avoid over-eager primes adding and excessive list processing.