<?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: Using a haskell dfa type to match strings</title>
	<atom:link href="http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/</link>
	<description></description>
	<lastBuildDate>Sun, 01 Apr 2012 20:37:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Toni Cebrián &#187; DFA libraries in Haskell</title>
		<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/comment-page-1/#comment-14847</link>
		<dc:creator>Toni Cebrián &#187; DFA libraries in Haskell</dc:creator>
		<pubDate>Sun, 07 Mar 2010 19:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://nickelcode.com/?p=661#comment-14847</guid>
		<description>[...] number of implementations written by Haskell enthusiasts and documented in their blogs like this one and this set of [...]</description>
		<content:encoded><![CDATA[<p>[...] number of implementations written by Haskell enthusiasts and documented in their blogs like this one and this set of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Bender</title>
		<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/comment-page-1/#comment-10098</link>
		<dc:creator>John Bender</dc:creator>
		<pubDate>Wed, 11 Nov 2009 22:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://nickelcode.com/?p=661#comment-10098</guid>
		<description>@Leon

Correct the function does not continue after reaching the final state the first time, which means the code does not work with _real_ DFA&#039;s. I could have called my type/post something else but I don&#039;t think it would have helped with the clarity for people like myself which have only the basics of CS from college (and what&#039;s there is in fact shoddy at best).

The next step for me is going to be actually building the Psuedo DFA from a string match input, but I am interested in learning more and I will take your advice an look into implementing intersection and union. Again, thanks for taking the time to read and pass along some more information/advice.</description>
		<content:encoded><![CDATA[<p>@Leon</p>
<p>Correct the function does not continue after reaching the final state the first time, which means the code does not work with _real_ DFA&#8217;s. I could have called my type/post something else but I don&#8217;t think it would have helped with the clarity for people like myself which have only the basics of CS from college (and what&#8217;s there is in fact shoddy at best).</p>
<p>The next step for me is going to be actually building the Psuedo DFA from a string match input, but I am interested in learning more and I will take your advice an look into implementing intersection and union. Again, thanks for taking the time to read and pass along some more information/advice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leon P Smith</title>
		<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/comment-page-1/#comment-10078</link>
		<dc:creator>Leon P Smith</dc:creator>
		<pubDate>Wed, 11 Nov 2009 12:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://nickelcode.com/?p=661#comment-10078</guid>
		<description>@John,  honestly,  I wouldn&#039;t worry much about that.

Taking a closer look at your code;  your second notion of &quot;match&quot; is wrong,  as it stops processing the string once you find a final state.

This issue aside,  if you are really interested in studying the tradeoffs between various representations,   you should try implementing some of the standard automata constructions:   for example,  can you define intersection :: DFA -&gt; DFA -&gt; DFA   and  union :: DFA -&gt; DFA -&gt; DFA?   How does the definitions for your representation(s) compare to the definitions for mine?</description>
		<content:encoded><![CDATA[<p>@John,  honestly,  I wouldn&#8217;t worry much about that.</p>
<p>Taking a closer look at your code;  your second notion of &#8220;match&#8221; is wrong,  as it stops processing the string once you find a final state.</p>
<p>This issue aside,  if you are really interested in studying the tradeoffs between various representations,   you should try implementing some of the standard automata constructions:   for example,  can you define intersection :: DFA -&gt; DFA -&gt; DFA   and  union :: DFA -&gt; DFA -&gt; DFA?   How does the definitions for your representation(s) compare to the definitions for mine?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Bender</title>
		<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/comment-page-1/#comment-10044</link>
		<dc:creator>John Bender</dc:creator>
		<pubDate>Tue, 10 Nov 2009 00:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://nickelcode.com/?p=661#comment-10044</guid>
		<description>@leon

my solution falls horribly short in use for different alphabets, which I realized as I was building it but didn&#039;t mention in the post. Many thanks for the comment.</description>
		<content:encoded><![CDATA[<p>@leon</p>
<p>my solution falls horribly short in use for different alphabets, which I realized as I was building it but didn&#8217;t mention in the post. Many thanks for the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leon P Smith</title>
		<link>http://johnbender.us/2009/11/08/using-a-haskell-dfa-type-to-match-strings/comment-page-1/#comment-10034</link>
		<dc:creator>Leon P Smith</dc:creator>
		<pubDate>Mon, 09 Nov 2009 07:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://nickelcode.com/?p=661#comment-10034</guid>
		<description>Another possibility is that you could follow the textbook definition of a DFA directly:

&lt;pre&gt;
data DFA st ab = DFA st (st -&gt; ab -&gt; st) (st -&gt; Bool)

machine :: DFA Int Char
machine = DFA 1 delta (== 4) 
   where
     delta 1 &#039;a&#039; = 2
     delta 1 &#039;b&#039; = 1
     delta 2 &#039;a&#039; = 3
     delta 2 &#039;b&#039; = 1
     delta 3 &#039;a&#039; = 3
     delta 3 &#039;b&#039; = 4
     delta _ _   = 5   -- a dead state

match :: DFA st ab -&gt; [ab] -&gt; Bool
match (DFA st delta isFinal) abs = isFinal (foldl delta st abs)
&lt;/pre&gt;

Although to be more useful,  you really need to have an enumeration of the alphabet.  (An enumeration of the states isn&#039;t so important.)</description>
		<content:encoded><![CDATA[<p>Another possibility is that you could follow the textbook definition of a DFA directly:</p>
<pre>
data DFA st ab = DFA st (st -&gt; ab -&gt; st) (st -&gt; Bool)

machine :: DFA Int Char
machine = DFA 1 delta (== 4)
   where
     delta 1 'a' = 2
     delta 1 'b' = 1
     delta 2 'a' = 3
     delta 2 'b' = 1
     delta 3 'a' = 3
     delta 3 'b' = 4
     delta _ _   = 5   -- a dead state

match :: DFA st ab -&gt; [ab] -&gt; Bool
match (DFA st delta isFinal) abs = isFinal (foldl delta st abs)
</pre>
<p>Although to be more useful,  you really need to have an enumeration of the alphabet.  (An enumeration of the states isn&#8217;t so important.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

