Lazy list/range comprehensions

"Jérôme M. Berger" jeberger at free.fr
Sun Oct 3 11:28:41 PDT 2010


bearophile wrote:
> Jérôme M. Berger:
> 
>> 	Why didn't you write the second like this to keep it functional:
>> result2 = dict (map (lambda x: (x, x*x), xrange (20)))
> 
> Because I've never seen people write it that way, and because for me it's less readable than the normal imperative code.
> 
	Oh, I agree that it's less readable, but wasn't that your point?
After all, the functional list generation with "map" is also less
readable than the corresponding imperative code.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101003/aec99ce9/attachment.pgp>


More information about the Digitalmars-d mailing list