<?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: Finding word frequencies using Erlang</title>
	<atom:link href="http://www.roberthorvick.com/2009/07/02/finding-word-frequencies-using-erlang/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.roberthorvick.com/2009/07/02/finding-word-frequencies-using-erlang/</link>
	<description>Things my wife doesn&#039;t want on the family blog...</description>
	<lastBuildDate>Tue, 09 Feb 2010 18:44:16 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Word frequency redux &#8211; Erlang list comprehension, regex and list folding &#171; Robert Horvick</title>
		<link>http://www.roberthorvick.com/2009/07/02/finding-word-frequencies-using-erlang/comment-page-1/#comment-5</link>
		<dc:creator>Word frequency redux &#8211; Erlang list comprehension, regex and list folding &#171; Robert Horvick</dc:creator>
		<pubDate>Thu, 02 Jul 2009 21:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.roberthorvick.com/?p=32#comment-5</guid>
		<description>[...] Cribbs was nice enough to point out a pair of changes I could make to my word frequency counter from last [...]</description>
		<content:encoded><![CDATA[<p>[...] Cribbs was nice enough to point out a pair of changes I could make to my word frequency counter from last [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://www.roberthorvick.com/2009/07/02/finding-word-frequencies-using-erlang/comment-page-1/#comment-4</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Thu, 02 Jul 2009 20:14:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.roberthorvick.com/?p=32#comment-4</guid>
		<description>@Sean

Thanks!  The re module certainly is an improvement.

I need to think more about lists:foldX.  

lists:foldl(fun(W, Dict) -&gt; dict:update(W, fun(C) -&gt; C + 1 end, 1, Dict) end, dict:new(), [&quot;foo&quot;, &quot;foo&quot;, &quot;bar&quot;]).

Edit: I said the above didn&#039;t work but in fact it did.  I was looking at the output in erl and forgettting the output is a dict, not a list.
</description>
		<content:encoded><![CDATA[<p>@Sean</p>
<p>Thanks!  The re module certainly is an improvement.</p>
<p>I need to think more about lists:foldX.  </p>
<p>lists:foldl(fun(W, Dict) -> dict:update(W, fun(C) -> C + 1 end, 1, Dict) end, dict:new(), ["foo", "foo", "bar"]).</p>
<p>Edit: I said the above didn&#8217;t work but in fact it did.  I was looking at the output in erl and forgettting the output is a dict, not a list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean</title>
		<link>http://www.roberthorvick.com/2009/07/02/finding-word-frequencies-using-erlang/comment-page-1/#comment-3</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Thu, 02 Jul 2009 14:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.roberthorvick.com/?p=32#comment-3</guid>
		<description>While there&#039;s nothing &quot;wrong&quot; with your code, per se, a suggestion - Erlang now has PCRE-style regular expressions, and the &#039;regexp&#039; module is being deprecated.

So you could capture all of the words in the string with something like this:

&lt;pre&gt;words(String) -&gt; 
  {match, Captures} = re:run(String, &quot;\\b\\w+\\b&quot;, [global,{capture,first,list}]),
  [hd(C) &#124;&#124; C&lt;-Captures]. % re returns the capture as a nested list&lt;/pre&gt;

Then I&#039;d probably use some kind of key-value structure, like a proplist or dict, to count the words using a lists:foldX function.</description>
		<content:encoded><![CDATA[<p>While there&#8217;s nothing &#8220;wrong&#8221; with your code, per se, a suggestion &#8211; Erlang now has PCRE-style regular expressions, and the &#8216;regexp&#8217; module is being deprecated.</p>
<p>So you could capture all of the words in the string with something like this:</p>
<pre>words(String) -&gt;
  {match, Captures} = re:run(String, "\\b\\w+\\b", [global,{capture,first,list}]),
  [hd(C) || C&lt;-Captures]. % re returns the capture as a nested list</pre>
<p>Then I&#8217;d probably use some kind of key-value structure, like a proplist or dict, to count the words using a lists:foldX function.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
