Re:CoffeeScript One Liners
by jessedhillon on Thursday June 02, 2011 @02:51PM
(#2613345)
> more of them will understand the comprehension than the map
What? Not if you poll programmers who had to go through SICP or take a real CS curriculum.
Look, I like the comprehensions better. I also think if you polled a large group of programmers and asked them what the code does, more of them will understand the comprehension than the map. Does that mean it's more expressive? I don't know, know one here agrees on a definition for expressiveness. But that's at least one positive (IMO) of comprehensions.
Also, stacking multiple comprehensions together is much easier (cartesian multiple style). E.g.: (i,j) for i in list_1 for j in list_2.
This is much easier to write and understand with comprehensions.
* Note - I know comprehensions from Python, let me know if the cartesian multiple example doesn't work in CoffeeScript.