<?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>Chui's counterpoint &#187; clojure</title>
	<atom:link href="http://www.redmountainsw.com/wordpress/archives/tag/clojure/feed" rel="self" type="application/rss+xml" />
	<link>http://www.redmountainsw.com/wordpress</link>
	<description>pulling the rug</description>
	<lastBuildDate>Fri, 19 Mar 2010 03:35:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Clojure symbol counting</title>
		<link>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting#comments</comments>
		<pubDate>Mon, 01 Jun 2009 23:27:39 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[clojure]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=774</guid>
		<description><![CDATA[One of the little things I found enjoyable while trying out Clojure was discovering the merge-with command. After counting the each of the subbranch and collecting the results in dictionaries, the dictionaries were merged together.

clojure.core/merge-with
([f &#038; maps])
  Returns a map that consists of the rest of the maps conj-ed onto
  the first.  [...]]]></description>
			<content:encoded><![CDATA[<p>One of the little things I found enjoyable while trying out <a href="http:/www.clojure.org/">Clojure</a> was discovering the <b>merge-with</b> command. After counting the each of the subbranch and collecting the results in dictionaries, the dictionaries were merged together.</p>
<pre>
clojure.core/merge-with
([f &#038; maps])
  Returns a map that consists of the rest of the maps conj-ed onto
  the first.  If a key occurs in more than one map, the mapping(s)
  from the latter (left-to-right) will be combined with the mapping in
  the result by calling (f val-in-result val-in-latter).
</pre>
<p>Using merge-with yields a rather terse code, comprising a tree-walker and a final tally.</p>
<pre>

(defn count-syms
  "count number time of a symbol occurs in the first place of a sequence"
  [obj]
  (if (not (seq? obj))
      {} ; only count sequences
      (do
        (reduce #(merge-with + %1 %2)
          (conj
            (map
                count-syms
                (filter seq? (rest obj)))
            (inc-dict dict (first obj)))))))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A plan for learning clojure</title>
		<link>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure#comments</comments>
		<pubDate>Mon, 01 Jun 2009 14:05:04 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[clojure]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=772</guid>
		<description><![CDATA[I had printed out the list of functions and macros in the Clojure API page, and it filled out two A4 pages. Where to start though? I walked the entire clojure and clojure contrib directory and counted the number of function calls. Here are the top stats.

sym	count	len
clojure.core/list	3872	17
quote	2749	5
defn	1757	4
clojure.core/seq	1481	16
clojure.core/concat	1480	19
=	1074	1
let	1042	3
is	885	2
.	836	1
if	826	2
defmethod	431	9
def	407	3
complex	377	7
defn-	376	5
fn	356	2
first	346	5
defmacro	298	8
clojure.core/apply	264	18
deftest	257	7
str	252	3
when	244	4
imaginary	238	9
recur	237	5
apply	229	5
instance?	220	9
nil	217	3
and	214	3
next	208	4
cl-format	206	9
fn*	197	3
ns	194	2
map	193	3
:use	187	4
list	184	4
1	181	1
count	178	5
+	169	1
seq	167	3
reduce	165	6
are	148	3
cons	143	4
println	141	7
or	141	2
not	135	3
loop	133	4
thrown?	127	7
*	127	1
conj	125	4
print	124	5
nth	124	3
-	116	1
doseq	114	5

Now, I have a study-plan.
Incidentally, waterfront IDE is quite [...]]]></description>
			<content:encoded><![CDATA[<p>I had printed out the list of functions and macros in the Clojure API page, and it filled out two A4 pages. Where to start though? I walked the entire clojure and clojure contrib directory and counted the number of function calls. Here are the top stats.</p>
<pre>
sym	count	len
clojure.core/list	3872	17
quote	2749	5
defn	1757	4
clojure.core/seq	1481	16
clojure.core/concat	1480	19
=	1074	1
let	1042	3
is	885	2
.	836	1
if	826	2
defmethod	431	9
def	407	3
complex	377	7
defn-	376	5
fn	356	2
first	346	5
defmacro	298	8
clojure.core/apply	264	18
deftest	257	7
str	252	3
when	244	4
imaginary	238	9
recur	237	5
apply	229	5
instance?	220	9
nil	217	3
and	214	3
next	208	4
cl-format	206	9
fn*	197	3
ns	194	2
map	193	3
:use	187	4
list	184	4
1	181	1
count	178	5
+	169	1
seq	167	3
reduce	165	6
are	148	3
cons	143	4
println	141	7
or	141	2
not	135	3
loop	133	4
thrown?	127	7
*	127	1
conj	125	4
print	124	5
nth	124	3
-	116	1
doseq	114	5
</pre>
<p>Now, I have a study-plan.</p>
<p>Incidentally, waterfront IDE is quite nice, particularly because I don&#8217;t have to learn Emacs key-bindings. There are some moments when it barfs and prints out hashmaps incorrectly, but I enjoyed working in a REPL environment. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
