<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Map, Filter and Reduce in Cocoa</title>
	<atom:link href="http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/feed/" rel="self" type="application/rss+xml" />
	<link>http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jan 2009 20:02:03 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: HeerneClitte</title>
		<link>http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-5480</link>
		<dc:creator>HeerneClitte</dc:creator>
		<pubDate>Sun, 03 Aug 2008 17:10:17 +0000</pubDate>
		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-5480</guid>
		<description>Brilliant!</description>
		<content:encoded><![CDATA[<p>Brilliant!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kongtomorrow</title>
		<link>http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2799</link>
		<dc:creator>kongtomorrow</dc:creator>
		<pubDate>Wed, 20 Jun 2007 20:04:49 +0000</pubDate>
		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2799</guid>
		<description>There aren&#039;t built-in methods for these operations, but there is nothing stopping you from adding them.

@implementation NSArray (FunctionalProgrammingAdditions)

// the selector &#039;reducer&#039; must take one object argument and return an object.
- (id)objectByReducingUsingSelector:(SEL)reducer {
    // implementation goes here
}

- (id)objectByReducingUsingFunction:(id (*)(id, id, void *))reducer context:(void *)context {
    // implementation goes here
}

// etc.
@end</description>
		<content:encoded><![CDATA[<p>There aren&#8217;t built-in methods for these operations, but there is nothing stopping you from adding them.</p>
<p>@implementation NSArray (FunctionalProgrammingAdditions)</p>
<p>// the selector &#8216;reducer&#8217; must take one object argument and return an object.<br />
- (id)objectByReducingUsingSelector:(SEL)reducer {<br />
    // implementation goes here<br />
}</p>
<p>- (id)objectByReducingUsingFunction:(id (*)(id, id, void *))reducer context:(void *)context {<br />
    // implementation goes here<br />
}</p>
<p>// etc.<br />
@end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Thomson</title>
		<link>http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2738</link>
		<dc:creator>Patrick Thomson</dc:creator>
		<pubDate>Tue, 19 Jun 2007 13:56:43 +0000</pubDate>
		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2738</guid>
		<description>Well, yes - print() is idempotent.

And why not have map() side effects? In Python, it seems useful to do this:

map((lambda x: x.capitalize()), [&quot;thanks&quot;, &quot;for&quot;, &quot;the&quot;, &quot;comment&quot;])

That method has side effects.

I&#039;m genuinely interested in your opinion.</description>
		<content:encoded><![CDATA[<p>Well, yes &#8211; print() is idempotent.</p>
<p>And why not have map() side effects? In Python, it seems useful to do this:</p>
<p>map((lambda x: x.capitalize()), ["thanks", "for", "the", "comment"])</p>
<p>That method has side effects.</p>
<p>I&#8217;m genuinely interested in your opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2732</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Tue, 19 Jun 2007 12:21:30 +0000</pubDate>
		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/06/18/map-filter-and-reduce-in-cocoa/#comment-2732</guid>
		<description>If you were to use map() in Python, and the function call you are mapping was to call system.out() or log() or print(), you would observe the same behavior that you describe as a gotcha in Obj-C when trying to use makeObjectsPerformSelector:.  The string still needs to be returned from the function call explicitly as a return value, not printed off to some buffer as a side effect.

Generally speaking, you probably don&#039;t want to use a function that causes side effects when using map() in any language, not just in Obj-C.</description>
		<content:encoded><![CDATA[<p>If you were to use map() in Python, and the function call you are mapping was to call system.out() or log() or print(), you would observe the same behavior that you describe as a gotcha in Obj-C when trying to use makeObjectsPerformSelector:.  The string still needs to be returned from the function call explicitly as a return value, not printed off to some buffer as a side effect.</p>
<p>Generally speaking, you probably don&#8217;t want to use a function that causes side effects when using map() in any language, not just in Obj-C.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
