<?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: Clojure: Parsing an RSS feed</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/11/30/clojure-parsing-an-rss-feed/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/11/30/clojure-parsing-an-rss-feed/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Wed, 17 Mar 2010 23:38:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Patrick Logan</title>
		<link>http://www.markhneedham.com/blog/2009/11/30/clojure-parsing-an-rss-feed/comment-page-1/#comment-27513</link>
		<dc:creator>Patrick Logan</dc:creator>
		<pubDate>Tue, 01 Dec 2009 16:20:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1885#comment-27513</guid>
		<description>Here&#039;s my take on your three items...

1. Using twitter-names as a global constant is fine. It&#039;s like a global constant function. When you need to update the map, add new attributes for the same key, etc. then revisit the issue. Until it bothers your code, don&#039;t sweat it.

2. Using &#039;first&#039; - it is not uncommon in Lisp code to do something line (def get-foo first) where the name get-foo communicates the intent better for your application. Then too if the implementation of get-foo changes you don&#039;t have to go through your code to determine whether each use of &#039;first&#039; should change. In that case just redefine get-foo.

3. Formatting defn&#039;s - if you can put a defn on a single line without impacting readability, do so. Don&#039;t impinge on readability or editability.</description>
		<content:encoded><![CDATA[<p>Here's my take on your three items&#8230;</p>
<p>1. Using twitter-names as a global constant is fine. It's like a global constant function. When you need to update the map, add new attributes for the same key, etc. then revisit the issue. Until it bothers your code, don't sweat it.</p>
<p>2. Using 'first' &#8211; it is not uncommon in Lisp code to do something line (def get-foo first) where the name get-foo communicates the intent better for your application. Then too if the implementation of get-foo changes you don't have to go through your code to determine whether each use of 'first' should change. In that case just redefine get-foo.</p>
<p>3. Formatting defn's &#8211; if you can put a defn on a single line without impacting readability, do so. Don't impinge on readability or editability.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Grand</title>
		<link>http://www.markhneedham.com/blog/2009/11/30/clojure-parsing-an-rss-feed/comment-page-1/#comment-27482</link>
		<dc:creator>Christophe Grand</dc:creator>
		<pubDate>Tue, 01 Dec 2009 10:28:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1885#comment-27482</guid>
		<description>&quot;I&#039;m used to parsing XML with XPath but that doesn&#039;t make as much sense when we have a sequence of hash maps. Instead I&#039;m using &#039;filter&#039; and &#039;map&#039; to try and achieve the same outcome.&quot;

filter and map are not always the handiest tools. Especially when your tree is not nicely flat and regular like this feed.

That&#039;s why Chouser authored zip-filters (xpath-like selection) and I created Enlive (css-like selection and transformation).

sample code to retrieve all items of a feed:
(-&gt; your-url duck-streams/reader (enlive/select [:item]))</description>
		<content:encoded><![CDATA[<p>"I'm used to parsing XML with XPath but that doesn't make as much sense when we have a sequence of hash maps. Instead I'm using 'filter' and 'map' to try and achieve the same outcome."</p>
<p>filter and map are not always the handiest tools. Especially when your tree is not nicely flat and regular like this feed.</p>
<p>That's why Chouser authored zip-filters (xpath-like selection) and I created Enlive (css-like selection and transformation).</p>
<p>sample code to retrieve all items of a feed:<br />
(-&gt; your-url duck-streams/reader (enlive/select [:item]))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Six</title>
		<link>http://www.markhneedham.com/blog/2009/11/30/clojure-parsing-an-rss-feed/comment-page-1/#comment-27456</link>
		<dc:creator>Bill Six</dc:creator>
		<pubDate>Tue, 01 Dec 2009 02:32:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1885#comment-27456</guid>
		<description>just a stylistic note --- &quot;#(foo %)&quot; creates an anonymous function of one variable, which calls a function foo with the anonymous function&#039;s variable.   

so something like this:
&quot;(def authors (map #(get-author %) rss-titles))&quot;

can instead be written like this:
&quot;(def authors (map get-author rss-titles))&quot;</description>
		<content:encoded><![CDATA[<p>just a stylistic note &#8212; "#(foo %)" creates an anonymous function of one variable, which calls a function foo with the anonymous function's variable.   </p>
<p>so something like this:<br />
"(def authors (map #(get-author %) rss-titles))"</p>
<p>can instead be written like this:<br />
"(def authors (map get-author rss-titles))"</p>
]]></content:encoded>
	</item>
</channel>
</rss>
