
On Feb 4, 2006, at 9:11 AM, John Hughes wrote:
I noticed ticket #55--add parallel list comprehensions--which according to the ticket, will probably be adopted. I would argue against. ...
I tend to agree. But to back myself up, I thought I'd do an informal survey of uses of "zip" or "zipWith" in comprehensions. I did this using "grep -C 5" and hand inspection, so tallys may be off by 1 or 2. I counted three things: 1) Uses of "zip" and friends which could be replaced by zip comprehensions, but which weren't simply numbering the elements of a list (OK) 2) Uses of the list numbering idiom "zip [n..] (...)" and "zip (...) [n...]" (Number) 3) Uses of "zip" and friends which are not list numbering, and cannot be replaced by zip comprehensions. (Not OK) Conclusion: Haskell would benefit from a library function for the list-numbering idiom. (Plus, such a library would play nicely with any evaluation strategy you care to name...) This would eliminate more than half the uses of "zip" in comprehension generators. I was surprised to see that phc would have been the biggest beneficiary of zip comprehensions! -Jan-Willem Maessen OK = Could use zip comprehensions. Number = zip [n..] (...) or zip (...) [n..] Not OK = Can't use zip comprehensions---prior or subsequent clauses OK Number Not OK phc 6 1 5 Djinn 4 DrIFT 4 fps 1 GHC 11 15 12 happy 11 HSlibs/ 2 8 libraries ---------------------------------------- Total 19 44 17