<?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"
	>
<channel>
	<title>Comments on: Take Two</title>
	<atom:link href="http://diversions.nfshost.com/blog/2008/07/09/take-two/feed/" rel="self" type="application/rss+xml" />
	<link>http://diversions.nfshost.com/blog/2008/07/09/take-two/</link>
	<description>Notes on things I'm thinking and doing</description>
	<pubDate>Thu, 04 Dec 2008 00:41:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Luke Evans</title>
		<link>http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3654</link>
		<dc:creator>Luke Evans</dc:creator>
		<pubDate>Tue, 05 Aug 2008 08:25:37 +0000</pubDate>
		<guid isPermaLink="false">http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3654</guid>
		<description>&lt;p&gt;Hi Tom,&lt;/p&gt;

&lt;p&gt;Thanks for fixing the formatting.  Looks like the tags in the string quotations got nixed by my not escaping the code blocks too.
As it stands, the code doesn't quite conform to specification ;-)&lt;/p&gt;

&lt;p&gt;-- Lwe&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Tom,</p>

<p>Thanks for fixing the formatting.  Looks like the tags in the string quotations got nixed by my not escaping the code blocks too.
As it stands, the code doesn&#8217;t quite conform to specification <img src='http://diversions.nfshost.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>&#8211; Lwe</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Evans</title>
		<link>http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3367</link>
		<dc:creator>Luke Evans</dc:creator>
		<pubDate>Mon, 28 Jul 2008 19:55:52 +0000</pubDate>
		<guid isPermaLink="false">http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3367</guid>
		<description>&lt;p&gt;Oops.  Forgot to escape the code blocks.  Oh well. [fixed :-)]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oops.  Forgot to escape the code blocks.  Oh well. [fixed :-)]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Evans</title>
		<link>http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3366</link>
		<dc:creator>Luke Evans</dc:creator>
		<pubDate>Mon, 28 Jul 2008 19:54:17 +0000</pubDate>
		<guid isPermaLink="false">http://diversions.nfshost.com/blog/2008/07/09/take-two/#comment-3366</guid>
		<description>&lt;p&gt;Unsurprisingly, if allow ourselves to use a few more list functions than things can improve still further:&lt;/p&gt;

&lt;pre&gt;out4 lst =
    let 
        processSplitSequence leading trailing = 
            (map fromChar leading) ++ (if isEmpty trailing then [] else ([""] ++ (map fromChar trailing) ++ [""]));
    in
        unwords $ concatMap (uncurry processSplitSequence) (map (splitAt 2) (group lst));&lt;/pre&gt;

&lt;p&gt;This does the same as out3, except that spaces are rendered between the tags and the span sequence.
This approach has the overt concept that sequences are composed of leading elements (the 2 items rendered ahead of the tagged block), and trailing elements (the remainder of any sequence).&lt;/p&gt;

&lt;p&gt;Again, 'group' really does most of the heavy-lifting.  After that, we simply split groups into leading and trailing sequences, then project each of these sequence pairs as the appropriate list of strings.  Then we concatenate the renderings from each group.  Finally, we use 'unwords' a library function that renders a list of strings as a single string with space separated elements.&lt;/p&gt;

&lt;p&gt;For the uninitiated, the weird 'uncurry' is only there because I chose to define processSplitSequence as a function of two clearly named arguments.  This has to be applied to a single pair (2-tuple), which is what uncurry does here.    An alternative could be:&lt;/p&gt;

&lt;pre&gt;out4a lst =
    let 
        processSplitSequence seqPair = 
            (map fromChar seqPair.#1) ++ (if isEmpty seqPair.#2 then [] else ([""] ++ (map fromChar seqPair.#2) ++ [""]));
    in
        unwords $ concatMap processSplitSequence (map (splitAt 2) (group lst));&lt;/pre&gt;

&lt;p&gt;...though it would be good in this case to create a let definition in processSplitSequence to capture "seqPair.#2" once.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Unsurprisingly, if allow ourselves to use a few more list functions than things can improve still further:</p>

<pre>out4 lst =
    let 
        processSplitSequence leading trailing = 
            (map fromChar leading) ++ (if isEmpty trailing then [] else ([""] ++ (map fromChar trailing) ++ [""]));
    in
        unwords $ concatMap (uncurry processSplitSequence) (map (splitAt 2) (group lst));</pre>

<p>This does the same as out3, except that spaces are rendered between the tags and the span sequence.
This approach has the overt concept that sequences are composed of leading elements (the 2 items rendered ahead of the tagged block), and trailing elements (the remainder of any sequence).</p>

<p>Again, &#8216;group&#8217; really does most of the heavy-lifting.  After that, we simply split groups into leading and trailing sequences, then project each of these sequence pairs as the appropriate list of strings.  Then we concatenate the renderings from each group.  Finally, we use &#8216;unwords&#8217; a library function that renders a list of strings as a single string with space separated elements.</p>

<p>For the uninitiated, the weird &#8216;uncurry&#8217; is only there because I chose to define processSplitSequence as a function of two clearly named arguments.  This has to be applied to a single pair (2-tuple), which is what uncurry does here.    An alternative could be:</p>

<pre>out4a lst =
    let 
        processSplitSequence seqPair = 
            (map fromChar seqPair.#1) ++ (if isEmpty seqPair.#2 then [] else ([""] ++ (map fromChar seqPair.#2) ++ [""]));
    in
        unwords $ concatMap processSplitSequence (map (splitAt 2) (group lst));</pre>

<p>&#8230;though it would be good in this case to create a let definition in processSplitSequence to capture &#8220;seqPair.#2&#8243; once.</p>]]></content:encoded>
	</item>
</channel>
</rss>
