<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
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:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Foognostic blogs &#187; clojure</title> <atom:link href="http://blogs.foognostic.net/topics/code/clojure/feed/" rel="self" type="application/rss+xml" /><link>http://blogs.foognostic.net</link> <description>Seeking knowledge of foo</description> <lastBuildDate>Thu, 24 Feb 2011 23:17:24 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Parens in uncomfortable places</title><link>http://blogs.foognostic.net/2011/01/parens-in-uncomfortable-places/</link> <comments>http://blogs.foognostic.net/2011/01/parens-in-uncomfortable-places/#comments</comments> <pubDate>Thu, 20 Jan 2011 04:12:23 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=399</guid> <description><![CDATA[Because my chances of writing Clojure code increase as the number of my peers writing Clojure increases, I have put time, energy, and money into encouraging others to write more Clojure code. This doesn't mean cramming Clojure into every possible nook and cranny. In some environments it's easy to become persona non grata by introducing [...]]]></description> <content:encoded><![CDATA[<p>Because my chances of writing Clojure code increase as the number of my peers
writing Clojure increases, I have put time, energy, and money into
encouraging others to write more Clojure code.</p><p>This doesn't mean cramming Clojure into every possible nook and
cranny. In some environments it's easy to become persona non grata by
introducing ANYthing which is perceived to be relatively difficult to
find support for.</p><p>I will also not back down from my opinion that any programming language
biased towards immutability should not be learned in production,
especially a language with parentheses in uncomfortable places. I will
claim that spending time with a Clojure REPL will lead to a series of quiet
a-HA! moments... just not as predictably as needed in production.</p><p>So why care? Because those lusty, quiet epiphanies are really
valuable. They are quick leaps towards a broader perspective on
programming. One where the paradox of a high-level low-level language
is put to good use. Don't take my word on it, check out what ESR <a
href="http://www.catb.org/~esr/faqs/hacker-howto.html#skills1">says
about Lisp</a>.</p><p>As one of the proud 429 <a
href="http://clojure.org/funders">funders</a> of Clojure, I encourage you to <a
href="http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started">get
started learning</a> Clojure. Or, if you know some already then try
to become a <a
href="http://lotrepls.appspot.com/">lord of the REPL</a>.</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2011/01/parens-in-uncomfortable-places/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>A quick tour of labrepl</title><link>http://blogs.foognostic.net/2010/04/a-quick-tour-of-labrepl/</link> <comments>http://blogs.foognostic.net/2010/04/a-quick-tour-of-labrepl/#comments</comments> <pubDate>Fri, 23 Apr 2010 12:45:34 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=388</guid> <description><![CDATA[A quick tour of labrepl is something I put together for the Washington DC Clojure meetup. Relevance did a great job with labrepl and graciously made it freely available. It works great for instructor-led training and is clearly designed to work in a self-study context. I added a little bit of background describing it and [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://foognostic.net/labrepl-summary/">A quick tour of labrepl</a> is something I put together for the Washington DC <a
target="top" href="http://www.meetup.com/Cap-Clug">Clojure meetup</a>. Relevance did a great job with <a
target="top" href="http://github.com/relevance/labrepl/">labrepl</a> and graciously made it freely available. It works great for instructor-led training and is clearly designed to work in a self-study context. I added a little bit of background describing it and a couple of ways you could take different paths through it to cover just the basics, go far enough to actually write some code, or even jump straight to some of the more interesting topics of Clojure which labrepl features.</p><p>Many thanks to the awesome @<a
target="top" href="http://twitter.com/brweber2">brweber2</a> for presenting <a
href="http://foognostic.net/labrepl-summary/">a quick tour of labrepl</a>.</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/04/a-quick-tour-of-labrepl/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Want to get started with Clojure?</title><link>http://blogs.foognostic.net/2010/04/want-to-get-started-with-clojure/</link> <comments>http://blogs.foognostic.net/2010/04/want-to-get-started-with-clojure/#comments</comments> <pubDate>Wed, 07 Apr 2010 12:22:59 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=383</guid> <description><![CDATA[Randomly curious about Clojure, but not quite sure how to get started? Members of the Clojure community have established this page as the best place to find current, complete instructions for using Clojure in your favorite IDE. Unless of course NOTEPAD.EXE is your thing... and who wants to go down the path of manually adding [...]]]></description> <content:encoded><![CDATA[<p>Randomly curious about <a
href="http://clojure.org/">Clojure</a>, but not quite sure how to get started? Members of the Clojure community have established <a
href="http://www.assembla.com/wiki/show/clojure/Getting_Started">this page</a> as the best place to find current, complete instructions for using Clojure in your favorite IDE.</p><p>Unless of course NOTEPAD.EXE is your thing... and who wants to go down the path of manually adding ))))))? Let an editor manage that for you!</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/04/want-to-get-started-with-clojure/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>A swank growl</title><link>http://blogs.foognostic.net/2010/02/a-swank-growl/</link> <comments>http://blogs.foognostic.net/2010/02/a-swank-growl/#comments</comments> <pubDate>Tue, 09 Feb 2010 03:55:32 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <category><![CDATA[code]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=373</guid> <description><![CDATA[I ran into a frustrating puzzle while learning about agents in Clojure. The problem was with a tool, not Clojure itself but a few neat things shook out along the way. Agents in Clojure are a high level concept for concurrency. They are intended for independent, asynchronous data munging. They're pretty easy to use... basically [...]]]></description> <content:encoded><![CDATA[<p>I ran into a frustrating puzzle while learning about <a
href="http://clojure.org/agents">agents</a> in Clojure. The problem was with a tool, not Clojure itself but a few neat things shook out along the way.</p><p>Agents in Clojure are a high level concept for concurrency. They are intended for independent, asynchronous data munging. They're pretty easy to use... basically a value is associated with an agent when it is created, and then when a function is applied to the agent the result becomes its new value.</p><p>Here is the definition of a banana agent:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> banana <span
style="color: #66cc66;">&#40;</span>agent <span
style="color: #ff0000;">&quot;ba&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>Here is the function which produces its new value:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> tally-man <span
style="color: #66cc66;">&#91;</span>berry<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">let</span> <span
style="color: #66cc66;">&#91;</span>input berry, output <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">str</span> berry <span
style="color: #ff0000;">&quot;na&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span>println <span
style="color: #66cc66;">&#40;</span>format <span
style="color: #ff0000;">&quot;input:output %s:%s&quot;</span> input output<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; output<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>Here it is in action:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user&gt; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> banana <span
style="color: #66cc66;">&#40;</span>agent <span
style="color: #ff0000;">&quot;ba&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span>await <span
style="color: #66cc66;">&#40;</span>send banana tally-man<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> @banana<br
/> <br
/> <span
style="color: #ff0000;">&quot;bana&quot;</span><br
/> user&gt; <span
style="color: #66cc66;">&#40;</span>await <span
style="color: #66cc66;">&#40;</span>send banana tally-man<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> @banana<br
/> <br
/> <span
style="color: #ff0000;">&quot;banana&quot;</span></div></div><p>The debug statements are missing! Code invoked by (send) doesn't yield output to the REPL -- it went to a different buffer.</p><p>The major symptom of my pernicious problem was that my precious debug statements weren't printing anything. This was a major problem since that was the only way I had to know what was happening. At this point it's important to disclose that I am an unrepentant GNU/Emacs user. This leads to using <a
href="http://github.com/technomancy/swank-clojure">swank-clojure</a> since a symbiotic REPL is really, really cool.</p><p>After much confusion I finally found my precious debug statements! They were hiding in the rarely-used <b><em>inferior-lisp</em></b> buffer. It's awkward for me to keep this buffer open so I looked for something... cooler.</p><p><a
href="http://growl.info/">Growl</a> is a MacOS X utility which displays notifications in self-dismissing windows. The gap between Clojure and Growl is little more than implementing java.io.Writer. Clojure actually makes it easier than it should be.</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> growl <span
style="color: #66cc66;">&#91;</span>msg<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span>.exec <span
style="color: #66cc66;">&#40;</span>Runtime/getRuntime<span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">str</span> <span
style="color: #ff0000;">&quot;/path/to/growlnotify -a emacs -m &quot;</span> msg<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> growler<br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">proxy</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#91;</span>java.io.Writer<span
style="color: #66cc66;">&#93;</span> <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span>flush <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#93;</span> <span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span>write <span
style="color: #66cc66;">&#91;</span>text<span
style="color: #66cc66;">&#93;</span> <span
style="color: #66cc66;">&#40;</span>growl text<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>It's worth taking a close look at the proxy statement, specifically the write method. It is an abstract, overloaded method in <a
href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Writer.html">Writer</a>. Only one of those overloads is abstract, and it's <b>NOT</b> the one implemented above. The one implemented above is the only one actually called. Or, you know, <a
href="http://en.wikipedia.org/wiki/Duck_typing">quacked</a>. That's neat! I didn't even have to implement all of the abstract methods! All I had to do is what I actually needed to do.</p><p>The last piece of the puzzle was making Clojure use the Growl bridge. The <a
href="http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/binding">binding</a> function made this happen with <b>one line of code</b>. <em>out</em> is the &quot;variable&quot; which Clojure uses for writing to standard out. A call to (binding) gives <em>out</em> a new value. and the old value is restored when (binding) exits. All of the compiled references to <em>out</em> within Clojure automatically use my binding. TOO COOL.</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> tally-man <span
style="color: #66cc66;">&#91;</span>berry<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">let</span> <span
style="color: #66cc66;">&#91;</span>input berry, output <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">str</span> berry <span
style="color: #ff0000;">&quot;na&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span>binding <span
style="color: #66cc66;">&#91;</span>*out* growler<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span>println <span
style="color: #66cc66;">&#40;</span>format <span
style="color: #ff0000;">&quot;input:output %s:%s&quot;</span> input output<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; output<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>Ta DA! <img
alt="" src="http://static.foognostic.net/growl.png" title="Growl" class="alignnone" width="286" height="57" /></p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/02/a-swank-growl/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>My week of Clojure and Emacs</title><link>http://blogs.foognostic.net/2010/01/my-week-of-clojure-and-emacs/</link> <comments>http://blogs.foognostic.net/2010/01/my-week-of-clojure-and-emacs/#comments</comments> <pubDate>Wed, 27 Jan 2010 04:59:29 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=362</guid> <description><![CDATA[This week has been very busy and useful for me with Clojure and Emacs. Clojure I continued to mature Pokerepl. The interfaces/defprotocols were reorganized into one file. Implementations/deftypes each have their own file. Switched Leiningen branch from stable to master (think 1.1 alpha) and chopped out all those :gen-class warts Lightly adopted @cemerick's very cool [...]]]></description> <content:encoded><![CDATA[<p>This week has been very busy and useful for me with Clojure and Emacs.</p><h3>Clojure</h3><ul><li>I continued to mature <a
href="http://bitbucket.org/seths/pokerepl/src/">Pokerepl</a>. The interfaces/defprotocols were reorganized into one file. Implementations/deftypes each have their own file.</li><li>Switched <a
href="http://github.com/technomancy/leiningen">Leiningen</a> branch from stable to master (think 1.1 alpha) and chopped out all those :gen-class warts</li><li>Lightly adopted <a
href="http://twitter.com/cemerick">@cemerick</a>'s <strong>very cool</strong> <a
href="http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure">string interpolation</a> macro -- it's the #{bar} in "foo #{bar}".<li>Got Nailgun working to <a
href="http://groups.google.com/group/leiningen/browse_thread/thread/66c6c72dba4bbd47">speed up unit tests</a>.</li><li>But <a
href="http://twitter.com/technomancy">@technomancy</a> pointed out that I could use TONS less memory and have a better experience with <a
href="http://github.com/technomancy/clojure-mode/blob/master/clojure-test-mode.el">clojure-test-mode</a>. It runs instantly and highlights errors:</li></ul><p><img
src="http://foognostic.net/clojure-test-mode.png" alt="Image of a test failing" /></p><h3>Emacs</h3><ul><li>I~ stopped~ backup~ files~ from~ appearing~ everywhere~ (thanks to <a
href="http://github.com/technomancy/emacs-starter-kit">ESK</a> for clueing me in to backup-directory-alist)</li><li>Stopped avoiding <a
href="http://gnuemacscolorthemetest.googlecode.com/svn/html/index-el.html">color-theme</a> <strong>finally</strong>. Using the rotor and late-night themes mostly, but will probably have to write my own at some point. It will be ugly, but such are my aesthetics.</li><li>Now using and happy with the <a
href="http://www.levien.com/type/myfonts/inconsolata.html">Inconsolata</a> typeface.</li><li>I installed but still shy away from paredit-mode. It's my own fault for not having watched this <a
href="http://www.slideshare.net/mudphone/paredit-preso">awesome preso</a> yet.</li></ul> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/01/my-week-of-clojure-and-emacs/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Wrapping deftype factory methods</title><link>http://blogs.foognostic.net/2010/01/wrapping-deftype-factory-methods/</link> <comments>http://blogs.foognostic.net/2010/01/wrapping-deftype-factory-methods/#comments</comments> <pubDate>Tue, 19 Jan 2010 02:35:47 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <category><![CDATA[code]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=349</guid> <description><![CDATA[(Standard disclaimer: Clojure is a new hobby.) I'm exploring the upcoming feature in Clojure called deftype. Similar to defining a class in Java, deftype is a way of grouping related data and methods. Actually, it's quite an improvement over the old (defstruct) way. defstruct only groups related data together. As ever, code examples are based [...]]]></description> <content:encoded><![CDATA[<p>(Standard disclaimer: <a
href="http://blogs.foognostic.net/disclaimer-clojure-is-a-new-hobby/">Clojure is a new hobby.</a>)</p><p>I'm exploring the upcoming feature in Clojure called <a
href="http://www.assembla.com/wiki/show/clojure/Datatypes">deftype</a>. Similar to defining a class in Java, deftype is a way of grouping related data and methods. Actually, it's quite an improvement over the old (defstruct) way. defstruct only groups related data together.</p><p>As ever, code examples are based on my side project <a
href="http://bitbucket.org/seths/pokerepl/src/">pokerepl</a>. This entire post focuses on the suits and values in a deck of playing cards.</p><p>Here's the old way of doing things:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #808080; font-style: italic;">;; define the struct</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defstruct</span> Card :value :suit<span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;; instantiate it</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> card <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> Card :ace :spades<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>Here's my first baby step down the new path:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span>deftype Card <span
style="color: #66cc66;">&#91;</span>#^clojure.lang.Keyword value<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#^clojure.lang.Keyword suit<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; Object<br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span>toString <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">str</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> value-<span
style="color: #b1b100;">map</span> value <span
style="color: #ff0000;">&quot;?&quot;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> suit-<span
style="color: #b1b100;">map</span> suit <span
style="color: #ff0000;">&quot;?&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> card <span
style="color: #66cc66;">&#40;</span>Card :ace :spades<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>It's longer, but it does more. We get <strong>optional</strong> type hinting for the data (seen here as #^clojure.lang.Keyword). The type being extended is listed (Object in this case). The override of Object.toString means all instances will be pretty printed automatically.</p><p>What you don't see is a &quot;constructor&quot;. There's no need because Clojure provides reasonable defaults here; the values for &quot;value&quot; and &quot;suit&quot; are passed to new instances of Card.</p><p>Unfortunately that wasn't good enough. Fortunately Clojure is a very dynamic programming language, so I could <strong>easily</strong> replace the implicitly defined factory function with my own code. To summarize, a call to (deftype Foo [bar]) generates two factory functions (Foo [bar]) and (Foo [bar meta-map ext-map]). It's possible to overwrite these but unclear how to honor the postconditions... exactly what gets returned?</p><p>So rather than replace the factory function entirely, I decided to embrace and extend it!</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> old-Card Card<span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> Card<br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #66cc66;">&#91;</span>two-chars<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">apply</span> Card <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">map</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">partial</span> <span
style="color: #b1b100;">nth</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">seq</span> two-chars<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #66cc66;">&#91;</span>0 1<span
style="color: #66cc66;">&#93;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #66cc66;">&#91;</span>value suit<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">let</span> <span
style="color: #66cc66;">&#91;</span>value-sym <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">if</span> <span
style="color: #66cc66;">&#40;</span>= clojure.lang.Keyword <span
style="color: #66cc66;">&#40;</span>class value<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">zipmap</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">vals</span> value-<span
style="color: #b1b100;">map</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">keys</span> value-<span
style="color: #b1b100;">map</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> value<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;suit-sym <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">if</span> <span
style="color: #66cc66;">&#40;</span>= clojure.lang.Keyword <span
style="color: #66cc66;">&#40;</span>class suit<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; suit<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">zipmap</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">vals</span> suit-<span
style="color: #b1b100;">map</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">keys</span> suit-<span
style="color: #b1b100;">map</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> suit<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span>old-Card value-sym suit-sym<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>So that's a bit of a mess, but the requirements were too. I needed syntactical sugar to make dealing with this code palatable. And now I have said sugar. The following is now true:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span>= <span
style="color: #66cc66;">&#40;</span>Card :ace :spades<span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span>Card <span
style="color: #ff0000;">&quot;AS&quot;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span>Card \A \S<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><p>My main gripe with (deftype) is that it complicates editor support. Previously, &quot;defn&quot; and a relatively small list of keywords meant a list was a function definition. Functions indent differently than other types of lists. deftype means the editor is going to have to understand the source better. But, it's a small and good problem to have IMO. Also hoping for destructuring support in vector for param arguments.</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/01/wrapping-deftype-factory-methods/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Presenting on Leiningen to Cap-Clug</title><link>http://blogs.foognostic.net/2010/01/presenting-on-leiningen-to-cap-clug/</link> <comments>http://blogs.foognostic.net/2010/01/presenting-on-leiningen-to-cap-clug/#comments</comments> <pubDate>Wed, 13 Jan 2010 00:44:24 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <category><![CDATA[leiningen]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=341</guid> <description><![CDATA[I'm excited to present Leiningen to a Wash. DC metro area Clojure meetup, a.k.a. Cap-Clug. Leiningen is a Clojure-friendly build tool, and I've been very happy using it on Pokerepl. In the presentation I am going to spend most of my time explaining how to build a minimal yet friendly jar file starting from scratch. [...]]]></description> <content:encoded><![CDATA[<p>I'm excited to present <a
href="http://github.com/technomancy/leiningen/tree/stable">Leiningen</a> to a Wash. DC metro area <a
href="http://www.meetup.com/Cap-Clug/">Clojure meetup</a>, a.k.a. Cap-Clug. Leiningen is a Clojure-friendly build tool, and I've been very happy using it on <a
href="http://bitbucket.org/seths/pokerepl/src/">Pokerepl</a>.</p><p>In the presentation I am going to spend most of my time explaining how to build a minimal yet friendly jar file starting from scratch. Time permitting we will be able to cover more spiffy features like integration with <a
href="http://clojars.org">Clojars</a>.</p><p>The other scheduled presentation is going to be great; <a
href="http://twitter.com/fogus">@Fogus</a> is co-writing <a
href="http://blog.fogus.me/2010/01/11/writing-the-next-clojure-book/">the next Clojure book</a> and he will be presenting on features new in version 1.1.</p><p>If you are in the Washington DC metro area and have any sort of interest in Clojure, run don't walk to <a
href="http://www.meetup.com/Cap-Clug/">register</a> -- the first meeting is Thurs Jan 14th, 2010. See you there!</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/01/presenting-on-leiningen-to-cap-clug/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Juggling versions of Clojure?</title><link>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/</link> <comments>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/#comments</comments> <pubDate>Sun, 03 Jan 2010 23:35:15 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <category><![CDATA[code]]></category> <category><![CDATA[GPLv3]]></category> <category><![CDATA[clojuggle]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=297</guid> <description><![CDATA[Clojuggle is a small tool to help people track and use various versions of Clojure with Slime/Swank.]]></description> <content:encoded><![CDATA[<p>(Standard disclaimer: <a
href="http://blogs.foognostic.net/disclaimer-clojure-is-a-new-hobby/">Clojure is a new hobby.</a>)</p><p>EDIT: also try rake clojure:new:repl</p><p>I am looking forward to trying <a
href="http://www.assembla.com/wiki/show/clojure/Datatypes">datatypes</a> on <a
href="http://bitbucket.org/seths/pokerepl/">Pokerepl</a>. However, that means using the <a
href="http://github.com/richhickey/clojure/tree/new">new branch of Clojure</a>, and indirectly, more work on my part to clone/track/build/deploy the new branch.</p><p>Almost everyone would and should use <a
href="http://github.com/technomancy/leiningen">Leiningen</a> to experiment with the new branch. Simply update your project.clj something like this:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;:dependencies <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#91;</span>org.clojure/clojure <span
style="color: #ff0000;">&quot;1.1.0-new-SNAPSHOT&quot;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #66cc66;">&#91;</span>org.clojure/clojure-contrib <span
style="color: #ff0000;">&quot;1.1.0-new-SNAPSHOT&quot;</span><span
style="color: #66cc66;">&#93;</span><span
style="color: #66cc66;">&#93;</span></div></div><p>At the moment though, updating ~/.clojure was beyond the ken of any automated tool I knew of. So I wrote a Rakefile and gave it a cheesy name... juggling Clojure... hmm... howzabout <a
href="http://bitbucket.org/seths/clojuggle/src/">Clojuggle</a>? Well... yeah...  sorry for that.</p><p>Back to the point: automating thorough (~/.m2 and ~/.clojure) updates and deployments of various versions of Clojure. Supporting common tasks (wipe, clone, build, &amp;c.) for several branches of several repositories means a thousand tasks will bloom and make the tool hard to use.</p><p>Ruby and the Rake API make it easy to define or show tasks only when relevant. I really enjoyed writing this code. Anyways, typing rake brings you to this:</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake<br
/> Welcome<span
style="color: #000000; font-weight: bold;">!</span> Try <span
style="color: #ff0000;">'rake -T'</span> <span
style="color: #000000; font-weight: bold;">for</span> a list of useful tasks, or try<br
/> &nbsp; &nbsp; rake clojure:master:all clojure-contrib:master:all</div></div><p>The default task provides some basic usage. Let's take a look at the initial set of tasks:</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span
style="color: #660033;">-T</span><br
/> rake clojure-contrib:master:all &nbsp;<span
style="color: #666666; font-style: italic;"># Do everything for master branch of clojure-contrib</span><br
/> rake clojure-contrib:new:all &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Do everything for new branch of clojure-contrib</span><br
/> rake clojure:master:all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #666666; font-style: italic;"># Do everything for master branch of clojure</span><br
/> rake clojure:new:all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Do everything for new branch of clojure</span><br
/> rake default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># HOWTO use this file</span></div></div><p>Fine, let's give it a whirl.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span
style="color: #000000; font-weight: bold;">time</span> rake clojure:new:all<br
/> <span
style="color: #666666; font-style: italic;"># oodles of lines omitted</span><br
/> ci-build:<br
/> <br
/> BUILD SUCCESSFUL<br
/> Total <span
style="color: #000000; font-weight: bold;">time</span>: 25 seconds<br
/> <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-f</span> <span
style="color: #000000; font-weight: bold;">/</span>...<span
style="color: #000000; font-weight: bold;">/</span>.clojure<span
style="color: #000000; font-weight: bold;">/</span>clojure.jar<br
/> <span
style="color: #c20cb9; font-weight: bold;">ln</span> <span
style="color: #660033;">-s</span> <span
style="color: #000000; font-weight: bold;">/</span>...<span
style="color: #000000; font-weight: bold;">/</span>clojuggle<span
style="color: #000000; font-weight: bold;">/</span>src<span
style="color: #000000; font-weight: bold;">/</span>clojure-new<span
style="color: #000000; font-weight: bold;">/</span>clojure.jar <span
style="color: #000000; font-weight: bold;">/</span>...<span
style="color: #000000; font-weight: bold;">/</span>.clojure<span
style="color: #000000; font-weight: bold;">/</span>clojure.jar<br
/> <br
/> real&nbsp; &nbsp; 0m55.306s<br
/> user&nbsp; &nbsp; 1m10.544s<br
/> sys 0m6.873s</div></div><p>Three subtle points here. First, the "ci-build" line is the clue that the local Maven2 repository was updated:</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span
style="color: #c20cb9; font-weight: bold;">ls</span> <span
style="color: #660033;">-l</span> ~<span
style="color: #000000; font-weight: bold;">/</span>.m2<span
style="color: #000000; font-weight: bold;">/</span>repository<span
style="color: #000000; font-weight: bold;">/</span>org<span
style="color: #000000; font-weight: bold;">/</span>clojure<span
style="color: #000000; font-weight: bold;">/</span>clojure<span
style="color: #000000; font-weight: bold;">/</span><br
/> total 8<br
/> drwxr-xr-x &nbsp;7 seths &nbsp;staff &nbsp;238 Jan &nbsp;3 17:57 1.1.0-new-SNAPSHOT<br
/> <span
style="color: #660033;">-rw-r--r--</span> &nbsp;<span
style="color: #000000;">1</span> seths &nbsp;staff &nbsp;<span
style="color: #000000;">322</span> Jan &nbsp;<span
style="color: #000000;">3</span> <span
style="color: #000000;">17</span>:<span
style="color: #000000;">57</span> maven-metadata-local.xml</div></div><p>Point #2: the ~/.clojure directory has a symlink pointing into the clojuggle/src/clojure-new directory.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span
style="color: #c20cb9; font-weight: bold;">ls</span> <span
style="color: #660033;">-l</span> ~<span
style="color: #000000; font-weight: bold;">/</span>.clojure<span
style="color: #000000; font-weight: bold;">/</span><br
/> total <span
style="color: #000000;">8</span><br
/> lrwxr-xr-x &nbsp;<span
style="color: #000000;">1</span> seths &nbsp;staff &nbsp;<span
style="color: #000000;">70</span> Jan &nbsp;<span
style="color: #000000;">3</span> <span
style="color: #000000;">17</span>:<span
style="color: #000000;">57</span> clojure.jar -<span
style="color: #000000; font-weight: bold;">&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>...<span
style="color: #000000; font-weight: bold;">/</span>clojuggle<span
style="color: #000000; font-weight: bold;">/</span>src<span
style="color: #000000; font-weight: bold;">/</span>clojure-new<span
style="color: #000000; font-weight: bold;">/</span>clojure.jar</div></div><p>Point #3: a few more commands have surfaced from the Rakefile (e.g. clojure:new:update)</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span
style="color: #660033;">-T</span><br
/> <span
style="color: #666666; font-style: italic;"># ... omitted</span><br
/> rake clojure:blast:it &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #666666; font-style: italic;"># Removes files for clojure from $HOME/.clojure and .m2</span><br
/> rake clojure:new:publish &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Push build to local m2 repo and ~/.clojure</span><br
/> rake clojure:new:update &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #666666; font-style: italic;"># Update the new branch of clojure</span></div></div><p>So that's all well and good, but what if you wanted to support <a
href="http://technomancy.us/">Technomancy's</a> <a
href="http://github.com/technomancy/clojure">fork</a> of Clojure? You would do two things. First this:</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span
style="color: #c20cb9; font-weight: bold;">cat</span> <span
style="color: #000000; font-weight: bold;">&gt;</span> user.yml<br
/> technomancy-clojure:<br
/> &nbsp; clone-from: git:<span
style="color: #000000; font-weight: bold;">//</span>github.com<span
style="color: #000000; font-weight: bold;">/</span>technomancy<span
style="color: #000000; font-weight: bold;">/</span>clojure.git<br
/> &nbsp; branches: <span
style="color: #7a0874; font-weight: bold;">&#91;</span>master, new<span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> &nbsp; use-jar: clojure.jar</div></div><p>And then something like this:</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span
style="color: #660033;">-T</span><br
/> &nbsp;<span
style="color: #666666; font-style: italic;"># ... omitted</span><br
/> rake technomancy-clojure:master:all &nbsp;<span
style="color: #666666; font-style: italic;"># Do everything for master branch of technomancy-clojure</span><br
/> rake technomancy-clojure:new:all &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Do everything for new branch of technomancy-clojure</span></div></div><h1>DANGER!</h1><p>Do <b>NOT</b> use this tool to develop on various versions of Clojure. The wipe task always deletes files, so eventually you will lose changes unintentionally. Eventually 'git status' will be used to prevent wiping changes but not yet.</p><p>Penultimately, despite all this I still don't have the new branch working with Slime/Swank. It doesn't help that the pom.xml of contrib on the new branch wants 1.1.0-alpha of Clojure. Minor nits though that can be worked out.</p><p>Finally, if anyone is still reading <b>and</b> cares about these sort of things, I picked Ruby, v3 of the GPL, and Mercurial/BitBucket because I have strong feelings about those things.</p><p>Please respond in some way if you have any questions!</p><p>tl;dr: Leiningen is great -- try using it with the new branch of Clojure!</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Why Clojure is worth it to me</title><link>http://blogs.foognostic.net/2009/12/why-clojure-is-worth-it-to-me/</link> <comments>http://blogs.foognostic.net/2009/12/why-clojure-is-worth-it-to-me/#comments</comments> <pubDate>Thu, 17 Dec 2009 02:37:44 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=294</guid> <description><![CDATA[I was glad to see Rich Hickey ask the Clojure community to financially support his dedicated time and energy during 2010. Much better this than unraveling with very little warning and causing a thousand forks to bloom. The asking price was very reasonable when you compare it to any large, respectable software development book. I [...]]]></description> <content:encoded><![CDATA[<p>I was glad to see Rich Hickey <a
href="http://groups.google.com/group/clojure/browse_thread/thread/cc77df25e98ce46b/5f40e7048e1f774e">ask the Clojure community</a> to financially support his dedicated time and energy during 2010. Much better this than unraveling with very little warning and causing a thousand forks to bloom.</p><p>The asking price was very reasonable when you compare it to any large, respectable software development book. I have many of those (well, maybe not all <a
href="http://soafacts.com/">10 volumes of SOA in a nutshell</a>)... but even my favorite books cover very narrow topics in great depth. That's it, just some dead trees waiting to be used as references for types of problems I don't run into often.</p><p>Clojure covers many topics in depth with consistent pragmatism. No time to bootstrap libraries? Use the plethora of .jar files out there. No time/focus to sustain a world-class virtual machine? Use Sun's! Not interested in churning out another keyword-heavy language grammar? Use Lisp... but thanks for cleaning it up first <img
src='http://blogs.foognostic.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p>The rest of the time can go writing a compiler sufficiently smart to avoid head holding by implementing <a
href="http://github.com/richhickey/clojure/commit/76c8f45293987b80e3599535dd86482e1180661d">fine-grained local clearing</a>... add some high level concepts for concurrency via software transactional memory? Sure!</p><p>Another tangible reason I'm happy to pay real money is the Clojure community. It has been helpful in many ways. Every major editor has some level of support... the IRC channel is <b>great</b>. People are even building infrastructure (looking at you <a
href="http://github.com/technomancy/leiningen">Leiningen</a> and <a
href="http://clojars.org/">Clojars</a>!)</p><p>Ultimately I'm just being selfish. Swearing at the REPL until enlightenment conks you on the head is a rush... it's a minor victory with a thousand similar battles on the horizon. I like supporting <a
href="http://www.openbsd.org/donations.html">good projects</a> and I'm looking forward to spending lots more time with <a
href="http://clojure.org">Clojure</a>.</p> ]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2009/12/why-clojure-is-worth-it-to-me/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The path of least resistance in Clojure</title><link>http://blogs.foognostic.net/2009/11/the-path-of-least-resistance-in-clojure/</link> <comments>http://blogs.foognostic.net/2009/11/the-path-of-least-resistance-in-clojure/#comments</comments> <pubDate>Tue, 24 Nov 2009 13:25:16 +0000</pubDate> <dc:creator>Seth Schroeder</dc:creator> <category><![CDATA[clojure]]></category> <category><![CDATA[code]]></category> <guid
isPermaLink="false">http://blogs.foognostic.net/?p=254</guid> <description><![CDATA[The path of least resistance in Clojure is the one less traveled by... come take a look.]]></description> <content:encoded><![CDATA[<p>(Edit 2: Standard disclaimer: <a
href="http://blogs.foognostic.net/disclaimer-clojure-is-a-new-hobby/">Clojure is a new hobby.</a>)</p><p>Immutable data structures seem like an odd idea, but they are on the path of least resistance in Clojure. This is <strong>not the case</strong> in languages like Java. In this post I will rewrite a snippet of Java into Clojure and explain the major differences.</p><p>The snippet of Java comes from Martin Fowler's <a
href="http://martinfowler.com/bliki/">bliki</a> posting on <a
href="http://martinfowler.com/bliki/FluentInterface.html">Fluent Interfaces</a>. I picked this code snippet because it is concise, reads easily, and fills a common need.</p><div
class="codecolorer-container java vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000066; font-weight: bold;">void</span> makeFluent<span
style="color: #009900;">&#40;</span>Customer customer<span
style="color: #009900;">&#41;</span> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; customer.<span
style="color: #006633;">newOrder</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span
style="color: #006633;">with</span><span
style="color: #009900;">&#40;</span><span
style="color: #cc66cc;">6</span>, <span
style="color: #0000ff;">&quot;TAL&quot;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span
style="color: #006633;">with</span><span
style="color: #009900;">&#40;</span><span
style="color: #cc66cc;">5</span>, <span
style="color: #0000ff;">&quot;HPK&quot;</span><span
style="color: #009900;">&#41;</span>.<span
style="color: #006633;">skippable</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span
style="color: #006633;">with</span><span
style="color: #009900;">&#40;</span><span
style="color: #cc66cc;">3</span>, <span
style="color: #0000ff;">&quot;LGV&quot;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span
style="color: #006633;">priorityRush</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span></div></div><p>This code clearly links an existing customer to a new, rush order of three items. Consider the "skippable" method... that is probably on the Order object yet works on an OrderLine. The Order code probably finds the newest OrderLine and updates its skippable property. Modifying objects is the path of least resistance in Java, or rather creating objects in an incomplete state and updating them until complete.</p><p>Modifying objects in Clojure is <b>not</b> on the path of least resistance. Many Clojure methods return a new, lazy version of the input. Working with return values like this encourages creating complete objects and <b>then</b> using them. Here's an example -- please temporarily ignore the unfamiliar functions and low level of abstraction.</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> add-order <span
style="color: #66cc66;">&#91;</span>customer<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">let</span> <span
style="color: #66cc66;">&#91;</span>lines <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> order-line <span
style="color: #cc66cc;">6</span>, <span
style="color: #ff0000;">&quot;TAL&quot;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct-map</span> order-line :quantity <span
style="color: #cc66cc;">5</span>,<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :code <span
style="color: #ff0000;">&quot;HPK&quot;</span>, :skippable? true<span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> order-line <span
style="color: #cc66cc;">3</span>, <span
style="color: #ff0000;">&quot;LGV&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; order <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct-map</span> order :lines lines,<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :rush? true<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">merge</span> customer<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#123;</span>:orders <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">conj</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> customer<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:orders <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#93;</span><span
style="color: #66cc66;">&#41;</span> order<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#125;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span></div></div><ul><li> (struct foo 123 "abc") is basically calling the constructor for the foo class with two arguments.</li><li> (struct-map foo :num 123, :text "abc") calls the constructor with named params rather than positional params</li><li> (let) is how you define local variables, lines and order in the above example.</li><li> (merge old-map new-map) creates a new map by merging existing maps</li><li> (conj) creates a new collection from its arguments</li><li> (get) returns the value for a key in a hash map, or a default value if specified.</li></ul><p>It's not obvious but the return value is the output from (merge). That is the last statement in the (let) block, which is the only statement in the body of the (add-order) function. Values flowing like this is in the path of least resistance in Clojure.</p><p>Besides doing things in a different order than Java, there is one more very important but subtle difference. Let's say a customer wants two orders:</p><p>Some quick code to show how it works:</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #808080; font-style: italic;">;; define a new customer and add an order</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> me <span
style="color: #66cc66;">&#40;</span>add-order <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> customer <span
style="color: #ff0000;">&quot;seth&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;; how many orders?</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #808080; font-style: italic;">;; 1</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;; I'd like another order, please...</span><br
/> <span
style="color: #66cc66;">&#40;</span>add-order me<span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;; Hey, where'd that go?</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #808080; font-style: italic;">;; 1</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;; Is the function even working?</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>:orders <span
style="color: #66cc66;">&#40;</span>add-order me<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #808080; font-style: italic;">;; 2, so yes</span></div></div><p>The new order has been lost because the return value from the function was not captured. This is a silent runtime failure -- not a fun type of problem to chase down. One solution is to rebind "me":</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> me <span
style="color: #66cc66;">&#40;</span>add-order me<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span> <span
style="color: #808080; font-style: italic;">;; 2</span></div></div><p>I've been a little dishonest here talking about "objects" in Clojure. As seen here they are little different than hash maps.</p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">example&gt; <span
style="color: #66cc66;">&#40;</span>. <span
style="color: #66cc66;">&#123;</span><span
style="color: #66cc66;">&#125;</span> getClass<span
style="color: #66cc66;">&#41;</span><br
/> clojure.lang.PersistentArrayMap<br
/> example&gt; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defstruct</span> foo :bar<span
style="color: #66cc66;">&#41;</span><br
/> #'example/foo<br
/> example&gt; <span
style="color: #66cc66;">&#40;</span>. <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> foo<span
style="color: #66cc66;">&#41;</span> getClass<span
style="color: #66cc66;">&#41;</span><br
/> clojure.lang.PersistentStructMap</div></div><p>For anyone who is interested, the entire source listing for this example follows. Thanks for reading!</p><p><span
id="more-254"></span></p><div
class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div
class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #808080; font-style: italic;">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">ns</span> example<span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defstruct</span> customer :<span
style="color: #b1b100;">name</span> :orders<span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defstruct</span> order :lines :rush?<span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defstruct</span> order-line :quantity :code :skippable?<span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">defn</span> add-order <span
style="color: #66cc66;">&#91;</span>customer<span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">let</span> <span
style="color: #66cc66;">&#91;</span>lines <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> order-line <span
style="color: #cc66cc;">6</span>, <span
style="color: #ff0000;">&quot;TAL&quot;</span><span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct-map</span> order-line :quantity <span
style="color: #cc66cc;">5</span>, :code <span
style="color: #ff0000;">&quot;HPK&quot;</span>, :skippable? true<span
style="color: #66cc66;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> order-line <span
style="color: #cc66cc;">3</span>, <span
style="color: #ff0000;">&quot;LGV&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; order <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct-map</span> order :lines lines, :rush? true<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">merge</span> customer<br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #66cc66;">&#123;</span>:orders <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">conj</span> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">get</span> customer :orders <span
style="color: #66cc66;">&#91;</span><span
style="color: #66cc66;">&#93;</span><span
style="color: #66cc66;">&#41;</span> order<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#125;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> me <span
style="color: #66cc66;">&#40;</span>add-order <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">struct</span> customer <span
style="color: #ff0000;">&quot;seth&quot;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> me<br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span>:lines <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>:lines <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">def</span> new-me <span
style="color: #66cc66;">&#40;</span>add-order me<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span>:lines <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">count</span> <span
style="color: #66cc66;">&#40;</span>:lines <span
style="color: #66cc66;">&#40;</span><span
style="color: #b1b100;">first</span> <span
style="color: #66cc66;">&#40;</span>me :orders<span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><span
style="color: #66cc66;">&#41;</span><br
/> <br
/> <span
style="color: #808080; font-style: italic;">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span></div></div>]]></content:encoded> <wfw:commentRss>http://blogs.foognostic.net/2009/11/the-path-of-least-resistance-in-clojure/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
