<?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/"
> <channel><title>Comments on: mapfilter</title> <atom:link href="http://streamhacker.com/2009/03/03/mapfilter/feed/" rel="self" type="application/rss+xml" /><link>http://streamhacker.com/2009/03/03/mapfilter/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link> <description>Weotta be Hacking</description> <lastBuildDate>Tue, 24 Aug 2010 14:34:00 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com" /> <atom:link rel="hub" href="http://superfeedr.com/hubbub" /> <item><title>By: willdampier</title><link>http://streamhacker.com/2009/03/03/mapfilter/comment-page-1/#comment-26</link> <dc:creator>willdampier</dc:creator> <pubDate>Fri, 27 Mar 2009 04:11:53 +0000</pubDate> <guid
isPermaLink="false">http://streamhacker.wordpress.com/?p=179#comment-26</guid> <description>In python I&#039;ve found generators to be amazingly useful.  I do something like this:
def mapfilter(KEY_FUN, LIST):
for this_item in LIST:
res = KEY_FUN(this_item)
if res:
yield res
This also removes any instances where KEY_FUN returns None as well.  This also works well if LIST is another generator since it only evaluates the function as  generator.next() is called.  It really helps if my intermediate objects start causing memory errors.</description> <content:encoded><![CDATA[<p>In python I&#8217;ve found generators to be amazingly useful.  I do something like this:<br
/> def mapfilter(KEY_FUN, LIST):<br
/> for this_item in LIST:<br
/> res = KEY_FUN(this_item)<br
/> if res:<br
/> yield res<br
/> This also removes any instances where KEY_FUN returns None as well.  This also works well if LIST is another generator since it only evaluates the function as  generator.next() is called.  It really helps if my intermediate objects start causing memory errors.</p> ]]></content:encoded> </item> <item><title>By: Jacob</title><link>http://streamhacker.com/2009/03/03/mapfilter/comment-page-1/#comment-25</link> <dc:creator>Jacob</dc:creator> <pubDate>Thu, 05 Mar 2009 16:05:21 +0000</pubDate> <guid
isPermaLink="false">http://streamhacker.wordpress.com/?p=179#comment-25</guid> <description>I think you mean flatmap/2, but no, I wasn&#039;t aware of it. I&#039;d think mapfilter/2 would still be faster, but perhaps I&#039;ll run some benchmarks to be sure. Thanks for pointing that out.</description> <content:encoded><![CDATA[<p>I think you mean flatmap/2, but no, I wasn&#8217;t aware of it. I&#8217;d think mapfilter/2 would still be faster, but perhaps I&#8217;ll run some benchmarks to be sure. Thanks for pointing that out.</p> ]]></content:encoded> </item> <item><title>By: Gleb Peregud</title><link>http://streamhacker.com/2009/03/03/mapfilter/comment-page-1/#comment-24</link> <dc:creator>Gleb Peregud</dc:creator> <pubDate>Thu, 05 Mar 2009 09:38:00 +0000</pubDate> <guid
isPermaLink="false">http://streamhacker.wordpress.com/?p=179#comment-24</guid> <description>Have you looked at lists:mapflat/2? mapfilter/2 is equivalent to mapflat/2 with Fun returning [] or [X]. Though the former could be a little bit faster</description> <content:encoded><![CDATA[<p>Have you looked at lists:mapflat/2? mapfilter/2 is equivalent to mapflat/2 with Fun returning [] or [X]. Though the former could be a little bit faster</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: streamhacker.com @ 2010-09-03 09:12:35 -->