<story><title>Why I chose Common Lisp over Python, Ruby, and Clojure</title><url>http://postabon.posterous.com/why-i-chose-common-lisp-over-python-ruby-and</url></story><parent_chain><item><author>ricree</author><text>&lt;i&gt;The fact that he proposed removing map, reduce, filter, and lambda from Python 3.&lt;/i&gt;&lt;p&gt;In the case of map and filter, is there any compelling reason to use either of those instead of list comprehensions or generator expressions?</text></item></parent_chain><comment><author>riobard</author><text>A single, non-nested list comprehension or generator exp is basically map(filter). You need nesting to get filter(map).&lt;p&gt;e.g.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    map(expensive_call, filter(cond, seq))
&lt;/code&gt;&lt;/pre&gt;
equals&lt;p&gt;&lt;pre&gt;&lt;code&gt;    [expensive_call(each) for each in seq if cond(each)]
&lt;/code&gt;&lt;/pre&gt;
but&lt;p&gt;&lt;pre&gt;&lt;code&gt;    filter(cond, map(expensive_call, seq))
&lt;/code&gt;&lt;/pre&gt;
equals&lt;p&gt;&lt;pre&gt;&lt;code&gt;    [each for each in [expensive_call(x) for x in seq] if cond(each)]
&lt;/code&gt;&lt;/pre&gt;
note because of &quot;expensive_call&quot;, it&apos;s inefficient (and silly) to do&lt;p&gt;&lt;pre&gt;&lt;code&gt;    [expensive_call(each) for each in seq if cond(expensive_call(each))]

&lt;/code&gt;&lt;/pre&gt;
So map/filter combination gives more flexibility than list comprehension, and for functional-thinking minds, it&apos;s just so natural to think in abstract terms of passing functions around. List comprehension is pretty syntactical sugar to do similar things, but it forces you think about the &quot;how to do&quot; instead of &quot;what to do&quot;.&lt;p&gt;That said, it&apos;s not really &quot;compelling&quot; though -- there is no real &quot;compelling&quot; reason to switch from one Turing-complete language to another given that you can do the same thing eventually. But hey, it&apos;s the itches that drive us nuts, isn&apos;t it? :)&lt;p&gt;Just my 2 cents</text></comment>
<story><title>Why I chose Common Lisp over Python, Ruby, and Clojure</title><url>http://postabon.posterous.com/why-i-chose-common-lisp-over-python-ruby-and</url></story><parent_chain><item><author>ricree</author><text>&lt;i&gt;The fact that he proposed removing map, reduce, filter, and lambda from Python 3.&lt;/i&gt;&lt;p&gt;In the case of map and filter, is there any compelling reason to use either of those instead of list comprehensions or generator expressions?</text></item></parent_chain><comment><author>smanek</author><text>Nope - just a style thing. You don&apos;t need lambdas either - named functions are just as powerful.&lt;p&gt;But I often think &apos;functionally.&apos; Since I have options, I&apos;d rather go with a language that allows me to program how I think - instead of being forced to translate my thought into its semantics.</text></comment>