<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Cute Haskell Code</title>
	<atom:link href="http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/</link>
	<description>Programming language geek-outs with your host, Max Bolingbroke</description>
	<lastBuildDate>Wed, 22 Apr 2009 11:47:14 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Morten</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-739</link>
		<dc:creator>Morten</dc:creator>
		<pubDate>Sun, 01 Feb 2009 19:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-739</guid>
		<description>Sorry, I forgot the i

import Monad

cipherText =  &quot;LUXDZNUAMNDODJUDTUZDGYQDLUXDGOJDCKDTKKJDOZ&quot;

i = 20

main = print (sequence $ cipherText &gt;&gt;= (\x -&gt; [foldM (\y a -&gt; lookup y (zip (&#039;Z&#039;:[&#039;A&#039;..&#039;Y&#039;]) [&#039;A&#039;..&#039;Z&#039;])) x [1..i]]))</description>
		<content:encoded><![CDATA[<p>Sorry, I forgot the i</p>
<p>import Monad</p>
<p>cipherText =  &#8220;LUXDZNUAMNDODJUDTUZDGYQDLUXDGOJDCKDTKKJDOZ&#8221;</p>
<p>i = 20</p>
<p>main = print (sequence $ cipherText &gt;&gt;= (\x -&gt; [foldM (\y a -&gt; lookup y (zip ('Z':['A'..'Y']) ['A'..'Z'])) x [1..i]]))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-738</link>
		<dc:creator>Morten</dc:creator>
		<pubDate>Sun, 01 Feb 2009 17:21:10 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-738</guid>
		<description>cipherText =  &quot;LUXDZNUAMNDODJUDTUZDGYQDLUXDGOJDCKDTKKJDOZ&quot;

main = print (sequence $ cipherText &gt;&gt;= (\x -&gt;  [lookup x (zip (&#039;Z&#039;:[&#039;A&#039;..&#039;Y&#039;]) [&#039;A&#039;..&#039;Z&#039;])]))

This solution uses monad bindings.</description>
		<content:encoded><![CDATA[<p>cipherText =  &#8220;LUXDZNUAMNDODJUDTUZDGYQDLUXDGOJDCKDTKKJDOZ&#8221;</p>
<p>main = print (sequence $ cipherText &gt;&gt;= (\x -&gt;  [lookup x (zip ('Z':['A'..'Y']) ['A'..'Z'])]))</p>
<p>This solution uses monad bindings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: batterseapower</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-44</link>
		<dc:creator>batterseapower</dc:creator>
		<pubDate>Sun, 13 May 2007 19:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-44</guid>
		<description>Ah, that&#039;s very nice indeed :-). And yeah, about the compile error: mea culpa. In my code that was &quot;undefined&quot;, but I felt I should add some error handling to clean it up for the post :-).</description>
		<content:encoded><![CDATA[<p>Ah, that&#8217;s very nice indeed <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . And yeah, about the compile error: mea culpa. In my code that was &#8220;undefined&#8221;, but I felt I should add some error handling to clean it up for the post <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-42</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Sun, 13 May 2007 14:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-42</guid>
		<description>I had to add a $ after error to get your program to compile. Now, here&#039;s my attempt at being cute:

shift i x = (dropWhile (/=x) $ [&#039;A&#039;..&#039;Z&#039;]++[&#039;A&#039;..&#039;Z&#039;]) !! i

This gives the error &quot;index too large&quot; from (!!) when x is not in [&#039;A&#039;..&#039;Z&#039;] or i is not in the proper range. (You&#039;d want to check the arguments more carefully in a real program.)</description>
		<content:encoded><![CDATA[<p>I had to add a $ after error to get your program to compile. Now, here&#8217;s my attempt at being cute:</p>
<p>shift i x = (dropWhile (/=x) $ ['A'..'Z']++['A'..'Z']) !! i</p>
<p>This gives the error &#8220;index too large&#8221; from (!!) when x is not in ['A'..'Z'] or i is not in the proper range. (You&#8217;d want to check the arguments more carefully in a real program.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: batterseapower</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-41</link>
		<dc:creator>batterseapower</dc:creator>
		<pubDate>Sun, 13 May 2007 14:24:01 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-41</guid>
		<description>Mmm, that&#039;s a nice solution too. Though what I particularly liked about the [&#039;A&#039;..&#039;Z&#039;] style is that it never at any point did the ASCII conversion: it was just a literal encoding of how a human would think about the problem.</description>
		<content:encoded><![CDATA[<p>Mmm, that&#8217;s a nice solution too. Though what I particularly liked about the ['A'..'Z'] style is that it never at any point did the ASCII conversion: it was just a literal encoding of how a human would think about the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vineet Kumar</title>
		<link>http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-40</link>
		<dc:creator>Vineet Kumar</dc:creator>
		<pubDate>Sun, 13 May 2007 08:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://bloggablea.wordpress.com/2007/05/09/cute-haskell-code/#comment-40</guid>
		<description>Maybe more readable?

&gt; import Char
&gt; shift i x = chr $ constrain $ ord x + i
&gt; 	where constrain n =
&gt; 		let a = ord &#039;A&#039; in
&gt; 		(n - a) `mod` 26 + a

Maybe not...</description>
		<content:encoded><![CDATA[<p>Maybe more readable?</p>
<p>&gt; import Char<br />
&gt; shift i x = chr $ constrain $ ord x + i<br />
&gt; 	where constrain n =<br />
&gt; 		let a = ord &#8216;A&#8217; in<br />
&gt; 		(n &#8211; a) `mod` 26 + a</p>
<p>Maybe not&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
