<?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>Looking Out To Sea &#187; Hobbies</title>
	<atom:link href="http://www.dougalstanton.net/blog/index.php/category/hobbies/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dougalstanton.net/blog</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 17:49:36 +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>Corpse Reviver</title>
		<link>http://www.dougalstanton.net/blog/index.php/2012/01/25/corpse-reviver/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2012/01/25/corpse-reviver/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 00:21:51 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/index.php/2012/01/25/corpse-reviver/</guid>
		<description><![CDATA[This is one of those traditional &#8220;I&#8217;m going to start blogging again, I promise&#8221; posts. Essentially I&#8217;ve installed the WordPress app on my phone so I&#8217;ll try to use it from the train and so on. Which also means you&#8217;ll have to excuse the typos.

As if to start, this evening I went to a Glasgow [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those traditional &#8220;I&#8217;m going to start blogging again, I promise&#8221; posts. Essentially I&#8217;ve installed the WordPress app on my phone so I&#8217;ll try to use it from the train and so on. Which also means you&#8217;ll have to excuse the typos.</p>

<p>As if to start, this evening I went to a Glasgow TechMeetup. There are Edinburgh equivalents that I never attended so I don&#8217;t know how they compare. The format was:</p>

<ul>
<li>beer and pizza at 6.30. Next time I must remember a bottle opener!</li>
<li>a welcome about 7pm including an introduction from everyone in the room. There must have been about fifty people in the room so it took about half an hour!</li>
<li>a few minutes to chat amongst ourselves, particularly with anyone who sounded interesting or employable. </li>
<li>a talk about web design</li>
<li>a talk about http caching</li>
</ul>

<p>The first talk was pretty dull and I was ready to call it a day at that point. Thankfully I didn&#8217;t cos the second talk was well worth the entry fee, even if it was free. If you bump into serialseb he gives a great talk - funny and informative.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2012/01/25/corpse-reviver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyWeek April 2011 post-mortem</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/04/13/pyweek-april-2011-post-mortem/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/04/13/pyweek-april-2011-post-mortem/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 20:52:09 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Friends]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1383</guid>
		<description><![CDATA[Well, it&#8217;s been a while since I wrote in this little box. My new job continues to form and my commute has been easier lately, since I&#8217;ve been getting a lift from a colleague who also lives in Edinburgh. I get back home in the evening much earlier, which is nice, though the start is [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s been a while since I wrote in this little box. My new job continues to form and my commute has been easier lately, since I&#8217;ve been getting a lift from a colleague who also lives in Edinburgh. I get back home in the evening much earlier, which is nice, though the start is still as early as ever (the alarm goes off at 5.30).</p>

<p>But I didn&#8217;t break this hiatus to talk about commuting, I promise. Last week was PyWeek, a twice-yearly programming challenge to write a computer game in the Python programming language. Nick was keen to give it a go, so between me, him and Mat we concocted an idea which was just interesting enough that it might be worth playing.</p>

<p>Due to some unforeseen problems we didn&#8217;t get much time to write code, so the game didn&#8217;t really come together in time for the deadline. I think, in fact, that the code was broken as zero-hour ticked over. Oh well.</p>

<p>Having started we decided to finish, so we all met on Monday night (for the first time since the challenge started&#8230;) and got large chunks of the game completed. It&#8217;s now playable, I think, though outrageously taxing and quite awkward for one person to play against themselves. The plan, then, is to iron out some of the kinks and see if we can pitch the difficulty at just the right level to make it addictive. Maybe we&#8217;ll get it transferred to an Android/iPhone app in the future?</p>

<p>I&#8217;ve known these guys for years but we&#8217;ve never actually sat down and written a program together for the fun of it. It was really interesting, especially since we were all basically learning Python from scratch for the purpose, and I was trying to remember what all this OO stuff is supposed to be about. Maybe we&#8217;ll tackle it again for the autumn PyWeek with a new game idea, more experience and maybe a bit more time scheduled to the task.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/04/13/pyweek-april-2011-post-mortem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting embedded in my new role</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/03/12/getting-embedded-in-my-new-role/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/03/12/getting-embedded-in-my-new-role/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 00:07:27 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Maths & Computer Science]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1379</guid>
		<description><![CDATA[I&#8217;m in a new job. I&#8217;ve done one week, so my life has mostly been on hold while I work out how things will fit together. I&#8217;m working for Honeywell Security writing embedded software. Similar to before but in alarm systems instead of networking.

The job requires a hefty commute &#8212; at least two hours each [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in a new job. I&#8217;ve done one week, so my life has mostly been on hold while I work out how things will fit together. I&#8217;m working for <a href="http://www.security.honeywell.com/" title="Honeywell Security Group">Honeywell Security</a> writing embedded software. Similar to before but in alarm systems instead of networking.</p>

<p>The job requires a hefty commute &#8212; at least two hours each way if things go well, but between delayed trains and poor weather it&#8217;s sometimes an extra half hour on top of that. Which means I get up at 5.30, leave the house before 6.30 and get home in the evening around 7&#160;o&#8217;clock. You can see why the rest of my life has been a bit quiet. I&#8217;m having to rethink how I look at the week. The arrival of the weekend is important and precious!</p>

<p>I&#8217;m still learning the ins and outs of work but the people are all very friendly and helpful, which makes the travelling more bearable. Spending hours travelling to and from a hateful job would be horrible. I spend an hour on the train each way which has given me more time for other things. I&#8217;ve been splitting my travelling activities, so that in the morning I read the freebie Metro for a bit and then do some &#8220;thinking&#8221; to limber up for the day. Recently I&#8217;ve been doing simple program calculation exercises, deriving the fusion rules for fold/unfold or map/map and so on. I&#8217;m really interested in the idea of deriving correct and efficient programs from executable specification.</p>

<p>(Just to show you what I&#8217;m talking about, this is the fold/unfold fusion rule. Let us say there are two functions, <code>foldr</code> and <code>unfoldr</code> defined as follows:</p>

<p><div>
<pre class="haskell"><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span style="font-weight: bold;">foldr</span></a> f z     <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> = z
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span style="font-weight: bold;">foldr</span></a> f z <span style="color: green;">&#40;</span>x:xs<span style="color: green;">&#41;</span> = f <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span style="font-weight: bold;">foldr</span></a> f z xs<span style="color: green;">&#41;</span>
&nbsp;
unfoldr g s = <span style="color: #06c; font-weight: bold;">case</span> g s <span style="color: #06c; font-weight: bold;">of</span>
                Nothing     -&gt; <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
                Just <span style="color: green;">&#40;</span>x,s'<span style="color: green;">&#41;</span> -&gt; x : unfoldr g s'</pre>
</div></p>

<p>The function <code>foldr</code> combines a list of elements according to the function <code>f</code> and <code>unfoldr</code> creates a list of elements from the seed <code>s</code>. We might use <code>foldr</code> to define a <code>product</code> function which combines the elements of the list by multiplying them together:</p>

<p><div>
<pre class="haskell"><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:product"><span style="font-weight: bold;">product</span></a> = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span style="font-weight: bold;">foldr</span></a> <span style="color: green;">&#40;</span>*<span style="color: green;">&#41;</span> <span style="color: red;">1</span></pre>
</div></p>

<p>And we might create a list of elements from 1 to <em>n</em> with an unfold.</p>

<p><div>
<pre class="haskell">enumTo n = unfoldr step <span style="color: red;">1</span>
  <span style="color: #06c; font-weight: bold;">where</span> step s = <span style="color: #06c; font-weight: bold;">if</span> s&gt;n <span style="color: #06c; font-weight: bold;">then</span> Nothing <span style="color: #06c; font-weight: bold;">else</span> Just <span style="color: green;">&#40;</span>s, s<span style="color: red;">+1</span><span style="color: green;">&#41;</span></pre>
</div></p>

<p>The observant reader will have noticed that combining these two separate functions will give us <code>factorial</code>, the product of numbers from 1 to <em>n</em> &#8212; first we create the numbers 1 to <em>n</em>, then we multiply them all together.</p>

<p><div>
<pre class="haskell">factorial = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:product"><span style="font-weight: bold;">product</span></a> . enumTo</pre>
</div></p>

<p>The inefficiency is that <code>enumTo</code> works on producing a list which is consumed by <code>product</code>. The elements are inserted into a list only to be removed straight away. Can we omit the redundant list production? It turns out we can, and we can do it for <em>all</em> cases where <code>foldr</code> operates on the result of <code>unfoldr</code>. The <code>product</code> and <code>enumTo</code> are specific instances of a general method which we can use to fuse production and consumption of values.</p>

<p>This fusion rule can be demonstrated by algebraic manipulation of the programs we&#8217;ve defined so far. We&#8217;ll call the <code>unfoldr</code> and then <code>foldr</code> by the name <code>hylo</code>, with the naive implementation shown:</p>

<p><div>
<pre class="haskell">hylo f z g = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldr"><span style="font-weight: bold;">foldr</span></a> f z . unfoldr g</pre>
</div></p>

<p>The equational style here facilitates some nice rearrangements which help to assert their correctness from step to step. Let&#8217;s see how this works &#8212; each line will be justified by some comment in braces:</p>

<p><div>
<pre>  hylo f z g s
= { definition from above }
  foldr f z (unfoldr g s)
= { definition of unfoldr }
  foldr f z (case g s of
                  Nothing     -&gt; []
                  Just (x,s') -&gt; x : unfoldr g s')
= { push foldr into result }
  case g s of
       Nothing     -&gt; foldr f z []
       Just (x,s') -&gt; foldr f z (x : unfoldr g s')
= { foldr on empty lists }
  case g s of
       Nothing     -&gt; z
       Just (x,s') -&gt; foldr f z (x : unfoldr g s')
= { foldr on non-empty lists }
  case g s of
       Nothing     -&gt; z
       Just (x,s') -&gt; f x (foldr f z (unfoldr g s'))
= { definition of hylo }
  case g s of
       Nothing     -&gt; z
       Just (x,s') -&gt; f x (hylo f z g s')</pre>
</div></p>

<p>Each step <em>should</em> be clearly equivalent to the one before and the one after, but by the end we have a definition for <code>hylo</code> which doesn&#8217;t construct a useless list.</p>

<p><div>
<pre class="haskell">hylo f z g s = <span style="color: #06c; font-weight: bold;">case</span> g s <span style="color: #06c; font-weight: bold;">of</span>
                 Nothing     -&gt; z
                 Just <span style="color: green;">&#40;</span>x,s'<span style="color: green;">&#41;</span> -&gt; f x <span style="color: green;">&#40;</span>hylo f z g s'<span style="color: green;">&#41;</span></pre>
</div></p>

<p>Naturally we can use the original definitions of <code>product</code> and <code>enumTo</code> to create an optimised <code>factorial</code> using this logic. The result is that <code>factorial</code> doesn&#8217;t create a redundant list either:</p>

<p><div>
<pre class="haskell">factorial n = hylo <span style="color: green;">&#40;</span>*<span style="color: green;">&#41;</span> <span style="color: red;">1</span> step
  <span style="color: #06c; font-weight: bold;">where</span> step s = <span style="color: #06c; font-weight: bold;">if</span> s &gt; n <span style="color: #06c; font-weight: bold;">then</span> Nothing <span style="color: #06c; font-weight: bold;">else</span> Just <span style="color: green;">&#40;</span>s,s<span style="color: red;">+1</span><span style="color: green;">&#41;</span></pre>
</div></p>

<p>I think this is beautiful result despite its obvious simplicity. However this has been a long digression, so I&#8217;ll stop now. But if you found it interesting I encourage you to check out work on &#8220;program calculation&#8221;, &#8220;program derivation&#8221;, &#8220;algebra of programming&#8221;, &#8220;origami programming&#8221; and so on.)</p>

<p>My evening journeys have been spent unwinding with a book, though the evening trains are noisier. I&#8217;m reading <em>Brighton Rock</em> right now and it&#8217;s good though the story makes me feel quite uncomfortable at times. One of the characters seems close to doing something wild and dangerous and it&#8217;s a fight between &#8220;must find out what happens&#8221; and &#8220;can&#8217;t bear to read any more&#8221; on a daily basis.</p>

<p>I hope week two will be easier and I will start to feel like my routine is falling into place. Watch this space.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/03/12/getting-embedded-in-my-new-role/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Not smart enough</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/02/05/not-smart-enough/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/02/05/not-smart-enough/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 15:25:58 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Comics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1370</guid>
		<description><![CDATA[

The sufficiently smart compiler is one that removes any need for engineering judgement/ability on the part of the programmer. The sufficiently aesthetic compiler does the same for artistic judgement.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/thederelictpavilion/5418151845/" title="Aesthetic Compilation by Dougal Stanton, on Flickr"><img src="http://farm6.static.flickr.com/5016/5418151845_7f36fd9e67_o.png" width="500" height="660" alt="comicstrip" class="show" /></a></p>

<p>The <a href="http://c2.com/cgi/wiki?SufficientlySmartCompiler">sufficiently smart compiler</a> is one that removes any need for engineering judgement/ability on the part of the programmer. The sufficiently aesthetic compiler does the same for artistic judgement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/02/05/not-smart-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parser troubles sorted</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/02/04/parser-troubles-sorted/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/02/04/parser-troubles-sorted/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 12:08:32 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1368</guid>
		<description><![CDATA[My troubles with parsing the ComicBake script format have been resolved, in particular by checking out John Goerzen&#8217;s ConfigFile package, which uses the same parser combinators to read INI files.

The code in ScriptParser.hs is slightly reduced and hopefully more robust and flexible than it was before. It certainly now recognises optional (Thinking) keyword, though right [...]]]></description>
			<content:encoded><![CDATA[<p>My troubles with <a href="http://www.dougalstanton.net/blog/index.php/2011/02/02/implementation-defined-file-format-and-parser-tut-tut/">parsing the ComicBake script format</a> have been resolved, in particular by checking out John Goerzen&#8217;s <a href="https://github.com/jgoerzen/configfile/blob/master/src/Data/ConfigFile/Parser.hs">ConfigFile package, which uses the same parser combinators to read INI files</a>.</p>

<p>The code in <code>ScriptParser.hs</code> is slightly reduced and hopefully more robust and flexible than it was before. It certainly now recognises optional <em>(Thinking)</em> keyword, though right now the option is ignored later in the compilation process.</p>

<p>One advantage of finalising the parser is that I have a much better idea what the file format is. It helped to crystallise some of the fuzzy areas in my mind. This is the inevitable result of any programming endeavour &#8212; vague ideas are made exact or abandoned altogether.</p>

<p>I&#8217;ve updated the README to describe the key/value format used for defining metadata, and ensured that the old comics all still build properly. The new parser just skips comments which were previously meaningful if they don&#8217;t have the correct keyword specified. So I didn&#8217;t need to rewrite my examples.</p>

<p>Also I just noticed that I&#8217;ve made 150 commits to this repository. I doubt that means anything but I&#8217;m surprised it&#8217;s so many. I suppose at one point I was being quite good about lots of little commits for independent changes. Lately I&#8217;ve just been working on hulking great code bombs which can&#8217;t be split up until after they&#8217;re done, and by then it hardly seems worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/02/04/parser-troubles-sorted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating the number of weekdays between two dates</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/02/03/calculating-the-number-of-weekdays-between-two-dates/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/02/03/calculating-the-number-of-weekdays-between-two-dates/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 15:34:07 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1362</guid>
		<description><![CDATA[Thinking about calculating the number of working days between two dates. (Note, I haven&#8217;t actually executed any of this code, just thought about it. It could be quite wrong.)


workingdays :: Day -&#62; Day -&#62; Integer
workingdays start end = undefined


For this scenario I assume that end is no earlier than start. (Obviously we can deal with [...]]]></description>
			<content:encoded><![CDATA[<p>Thinking about calculating the number of working days between two dates. (Note, I haven&#8217;t actually executed any of this code, just thought about it. It could be quite wrong.)</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined"><span style="font-weight: bold;">undefined</span></a></pre>
</div></p>

<p>For this scenario I assume that <code>end</code> is no earlier than <code>start</code>. (Obviously we can deal with this situation using some wrapper function to sort the dates if the result depends on this order.)</p>

<p>If <code>start</code> and <code>end</code> are the same day we define this as &#8220;zero working days&#8221;.</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end | start == end = <span style="color: red;">0</span>
                      | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span style="font-weight: bold;">otherwise</span></a>    = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined"><span style="font-weight: bold;">undefined</span></a></pre>
</div></p>

<p>If <code>start</code> and <code>end</code> are both the same day of the week then there will be a whole number of &#8220;working weeks&#8221; between the dates, eg one Monday to the next Monday is one working week. A working week is 5 days, so the number of working days is the number of working weeks times five.</p>

<p>We determine if two dates occur on the same day of the week by checking the number of days between them. Any number which is a multiple of seven (0, 7, 14, 21, &#8230;) indicates the two dates are a whole number of weeks apart. Multiples of seven produce a remainder of zero when divided by seven, so we divide the span by seven and check the remainder.</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end | start == end = <span style="color: red;">0</span>
                      | is_sameday   = <span style="color: red;">5</span> * wholeweeks
                      | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span style="font-weight: bold;">otherwise</span></a>    = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined"><span style="font-weight: bold;">undefined</span></a>
    <span style="color: #06c; font-weight: bold;">where</span> is_sameday = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mod"><span style="font-weight: bold;">mod</span></a>` <span style="color: red;">7</span> == <span style="color: red;">0</span>
          wholeweeks = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:div"><span style="font-weight: bold;">div</span></a>` <span style="color: red;">7</span></pre>
</div></p>

<p>At this point we notice that the first scenario is a simplified case of the second, where the two dates occur on the same day of the week with exactly <em>no</em> weeks between them. We can just collapse them into one calculation.</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end | is_sameday = <span style="color: red;">5</span> * wholeweeks
                      | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span style="font-weight: bold;">otherwise</span></a>  = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined"><span style="font-weight: bold;">undefined</span></a>
    <span style="color: #06c; font-weight: bold;">where</span> is_sameday = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mod"><span style="font-weight: bold;">mod</span></a>` <span style="color: red;">7</span> == <span style="color: red;">0</span>
          wholeweeks = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:div"><span style="font-weight: bold;">div</span></a>` <span style="color: red;">7</span></pre>
</div></p>

<p>If the two dates don&#8217;t fall on the same day there may be some fraction of a working week between the two. The number of days leftover in the last week is the remainder when the number of weeks is calculated, which we&#8217;ve already worked out once. Rather than doing it twice we&#8217;ll separate it out into whole weeks and days.</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end | days == <span style="color: red;">0</span> = <span style="color: red;">5</span> * weeks
                      | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span style="font-weight: bold;">otherwise</span></a> = <span style="color: red;">5</span> * weeks + partweek
    <span style="color: #06c; font-weight: bold;">where</span> <span style="color: green;">&#40;</span>weeks,days<span style="color: green;">&#41;</span> = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:divMod"><span style="font-weight: bold;">divMod</span></a>` <span style="color: red;">7</span>
          partweek     = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined"><span style="font-weight: bold;">undefined</span></a></pre>
</div></p>

<p>The bit we don&#8217;t know yet is the number of working days which make up the last part-week. The value of <code>partweek</code> is between zero and <code>days</code> with an upper limit of 5 because there can only be 5 working days between any two dates less than a week apart. At this point we&#8217;d be as well to just count them.</p>

<p><div>
<pre class="haskell">workingdays :: Day -&gt; Day -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Integer"><span style="color: #cccc00; font-weight: bold;">Integer</span></a>
workingdays start end | days == <span style="color: red;">0</span> = <span style="color: red;">5</span> * weeks
                      | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise"><span style="font-weight: bold;">otherwise</span></a> = <span style="color: red;">5</span> * weeks + partweek
    <span style="color: #06c; font-weight: bold;">where</span> <span style="color: green;">&#40;</span>weeks,days<span style="color: green;">&#41;</span> = diffDays start end `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:divMod"><span style="font-weight: bold;">divMod</span></a>` <span style="color: red;">7</span>
          partweek     = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:length"><span style="font-weight: bold;">length</span></a> $ <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"><span style="font-weight: bold;">filter</span></a> weekday $ <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:enumFromTo"><span style="font-weight: bold;">enumFromTo</span></a> newstart end
          newstart     = addDays <span style="color: green;">&#40;</span><span style="color: red;">7</span> * weeks + <span style="color: red;">1</span><span style="color: green;">&#41;</span> start</pre>
</div></p>

<p>We count the number of weekdays from the day <em>after</em> the first day, since that day doesn&#8217;t count. At this point it probably hasn&#8217;t escaped you that we&#8217;ve got more repetition. We could remove the first case (for whole weeks) because <code>partweek</code> will evaluate to zero in that case.</p>

<p>If there is a nicer way to calculate the remaining part of the week I haven&#8217;t spotted it. I feel sure there must be something better than just looping over the remaining days, though maybe I am wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/02/03/calculating-the-number-of-weekdays-between-two-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementation-defined file format and parser: tut tut.</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/02/02/implementation-defined-file-format-and-parser-tut-tut/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/02/02/implementation-defined-file-format-and-parser-tut-tut/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 23:22:03 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1357</guid>
		<description><![CDATA[In the last few days I&#8217;ve been snatching some moments to rewrite the awful, ugly parser in ComicBake into something readable and adaptable. While doing this I&#8217;ve been slowly rewriting the format of the accepted scripts. All of the improvements have been fairly subtle but sometimes with large improvements in usability and ease of implementation.

The [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few days I&#8217;ve been snatching some moments to rewrite the awful, ugly parser in ComicBake into something readable and adaptable. While doing this I&#8217;ve been slowly rewriting the format of the accepted scripts. All of the improvements have been fairly subtle but sometimes with large improvements in usability and ease of implementation.</p>

<p>The big one is the comments. Previously the first N comments were hard-coded to contain the <em>comic title</em>, <em>author</em> and other information, prefixed with the &#8220;comment delimiter&#8221;, a double-dash symbol. I&#8217;ve adopted a key-value style instead which means comments can be included (or omitted) as necessary from the header without problem:</p>

<p>Old style:</p>

<p><div>
<pre>-- Pandemic
-- Board games
-- Dougal Stanton
-- January 2011</pre>
</div></p>

<p>New style:</p>

<p><div>
<pre>-- title: Pandemic
-- series: Board games
-- author: Dougal Stanton
-- date: January 2011</pre>
</div></p>

<p>At the moment I&#8217;m only storing the title and author names but it&#8217;s possible to tag anything now and use it later if necessary. The tags can be re-ordered as desired and if you miss them altogether I just use an empty string.</p>

<p>I&#8217;m also experimenting with adding directions to indicate speech/thought bubbles. At the moment the code uses this format but it may change:</p>

<p><div>
<pre>Garfield: (Thinking)
    I hate Mondays</pre>
</div></p>

<p>Sadly I&#8217;ve realised that the language is still ambiguous about divisions between scenes. A scene may end when a new one starts, or when the file ends. Getting it to manage both is proving awkward. I don&#8217;t want to add more syntactic elements just to make it easier to parse, so I&#8217;ll have to see how other languages which define loosely-grouped sections (eg, INI files) are parsed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/02/02/implementation-defined-file-format-and-parser-tut-tut/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Both hands on the ground, both feet in the air?</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/01/26/both-hands-on-the-ground-both-feet-in-the-air/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/01/26/both-hands-on-the-ground-both-feet-in-the-air/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 01:33:45 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Culture]]></category>
		<category><![CDATA[Hobbies]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1348</guid>
		<description><![CDATA[For about six months now I (and then Helen) have been going to Capoeira Angola classes run by M&#227;o no Ch&#227;o group. Suffice it to say we are neither of the people in this photograph in fact, it&#8217;s just one I found on Flickr.





Describing Capoeira is a mug&#8217;s game. It&#8217;s not similar to anything else [...]]]></description>
			<content:encoded><![CDATA[<p>For about six months now I (and then Helen) have been going to <a href="http://en.wikipedia.org/wiki/Capoeira_Angola">Capoeira Angola</a> classes run by <a href="http://www.maonochao.org/">M&atilde;o no Ch&atilde;o group</a>. Suffice it to say we are neither of the people in this photograph in fact, it&#8217;s just one I found on Flickr.</p>

<p><a href="http://www.flickr.com/photos/mendesrocha/4216708696/" title="Leninho esquivando do golpe de m. Goiano by mendesrocha, on Flickr"><img class="show" src="http://farm3.static.flickr.com/2535/4216708696_15730efec7.jpg" width="500" height="375" alt="Leninho esquivando do golpe de m. Goiano" /></a></p>

<p><span id="more-1348"></span></p>

<p>Describing Capoeira is a mug&#8217;s game. It&#8217;s not similar to anything else I&#8217;ve seen or done. I would say &#8220;you have to see it&#8221; but even that doesn&#8217;t always help, I find. I&#8217;ll include a video anyway, and you can make of it what you will.</p>

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/Hsk2P4pyYBk" frameborder="0" allowFullScreen></iframe>

<p>The important thing to me is that I&#8217;m getting some form of exercise which I don&#8217;t resent. The charm of going to a gym very quickly wears off, but the variety of learning new skills and working with friendly people keeps everything enjoyable. The community is an important part too, and the culture of friendliness. Everybody is willing to help out new people, and advice filters across from other people as much as it comes from above.</p>

<p>On top of the exercise there&#8217;s other nice benefits, like increased flexibility and learning how to do handstands. A lot of the moves are things I should practise more regularly but I feel that accidentally kicking a hole in the television would be a poor outcome for that level of dedication. I guess the alternative is to do strengthening exercises to help make the moves easier. My thighs are always sore the day after a session &#8212; the muscles you use to sit down or stand up complain enormously. Traditional stuff like sit-ups would probably help too, as there are loads of moves which use those core muscles.</p>

<p>The musical side is good too. I now feel that I could pick up a tambourine or congo and beat out a not-terrible rhythm. This may not actually be true, but let&#8217;s not spoil my illusions just yet. The big boy of the musical side of capoeira, the berimbau, is an instrument that I have had no fortune with at all. I&#8217;ve not really had much opportunity to really practise, not having one lying around the house, but every time I&#8217;ve picked one up the one or two elements of co-ordination required (hold instrument steady; hold stone against string; pull stone away from string; move gourd away from and toward chest) have been totally beyond me. All I really achieve is an incredibly sore finger: &#8220;berimbau pinky&#8221;.</p>

<p>The singing is tricky because I have very little sense of rhythm (which means that any instrument I&#8217;m playing suffers if I try singing at the same time) and I&#8217;m not very good at &#8220;hearing&#8221; the words of songs in a foreign language. Singing along to songs you don&#8217;t know can be hard enough but as it&#8217;s all in Brazilian Portuguese the difficulty level ramps up considerably. I&#8217;m slowly wrapping my head around the largest difficulties, like how to map between spelling and sounds when reading about the game, and especially reading song lyrics. My singing&#8217;s still awful though. ;-)</p>

<p>All of this is part of the learning process and, as I mentioned, I&#8217;m enjoying it more than enough to stick around and <em>learn</em>. I&#8217;ll let you know when I master that head-stand.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/01/26/both-hands-on-the-ground-both-feet-in-the-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ComicBake with comic publishing capabilities!</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/01/22/comicbake-with-comic-publishing-capabilities/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/01/22/comicbake-with-comic-publishing-capabilities/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 14:09:54 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1331</guid>
		<description><![CDATA[Version 0.2 of ComicBake has just been pushed to the online repository. The changes since 0.1 were mostly internal reorganisation though there were some useful additions:


Rounded corners for speech bubbles
Use estimated box size for layout to prevent accidental overlaps and increase accuracy of inter-bubble spacing.
Publish to Flickr


The last one is the most important new addition. [...]]]></description>
			<content:encoded><![CDATA[<p>Version 0.2 of ComicBake has just been pushed to the <a href="http://www.dougalstanton.net/code/comicbake/" title="Darcs repository for ComicBake">online repository</a>. The changes since 0.1 were mostly internal reorganisation though there were some useful additions:</p>

<ul>
<li>Rounded corners for speech bubbles</li>
<li>Use estimated box size for layout to prevent accidental overlaps and increase accuracy of inter-bubble spacing.</li>
<li>Publish to Flickr</li>
</ul>

<p>The last one is the most important new addition. Now, once you&#8217;re happy with the look of the comic you can push it to Flickr. The client remembers logins between invocations so once you&#8217;ve authorised it to upload everything will work smoothly.</p>

<p>To this end I&#8217;ve split apart the function of the <code>comicbake</code> tool into <em>build</em> and <em>publish</em> sub-commands. Build works as before and is the default behaviour if you don&#8217;t specify a command.</p>

<p>To make and upload a previously scripted comic you now do this (making use of the default <code>comicstrip.png</code> file name):</p>

<p><div>
<pre>$ comicbake build -i scripts/mycomic.script
$ comicbake publish --title=&quot;My great comic&quot;</pre>
</div></p>

<p>There are still plenty of issues to work out with this interface, and further work needed elsewhere, but ultimately I&#8217;m pretty happy with how things are working out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/01/22/comicbake-with-comic-publishing-capabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A look at Lightweight Static Capabilities (part 1)</title>
		<link>http://www.dougalstanton.net/blog/index.php/2011/01/16/a-look-at-lightweight-static-capabilities-part-1/</link>
		<comments>http://www.dougalstanton.net/blog/index.php/2011/01/16/a-look-at-lightweight-static-capabilities-part-1/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 20:10:29 +0000</pubDate>
		<dc:creator>Dougal</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Maths & Computer Science]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dougalstanton.net/blog/?p=1310</guid>
		<description><![CDATA[I started to look at the Lightweight Static Capabilities paper over lunch on Friday. This is far too big an paper to consume in half an hour and I&#8217;m a long way from understanding it all. I thought the best way to increase my understanding was to write down my thoughts on and understanding of [...]]]></description>
			<content:encoded><![CDATA[<p>I started to look at the <a href="http://okmij.org/ftp/Computation/lightweight-dependent-typing.html#Lightweight" title="Lightweight static capabilities, Kiselyov and Shan">Lightweight Static Capabilities</a> paper over lunch on Friday. This is far too big an paper to consume in half an hour and I&#8217;m a long way from understanding it all. I thought the best way to increase my understanding was to write down my thoughts on and understanding of each section as I come to it. (The examples here are given in Haskell-like syntax, with fewer obscure operators. Conseuqently I&#8217;ve used the type name <code>List a</code> instead of <code>[a]</code> and <code>cons</code> instead of infix <code>:</code>.)</p>

<p>The area the paper looks at is labeled &#8220;lightweight dependent typing&#8221; &#8212; dependent typing without dependent types, essentially. Dependent type systems allow the programmer to specify types based on the values, so the programmer can ensure that lists will necessarily be non-empty and denominators necessarily non-zero, among other useful examples. The paper looks at ways of creating type safe &#8220;capabilities&#8221; without dependent types.</p>

<p>I will take the paper a little bit at a time, and as I read on I might have to correct previous misreadings/misinterpretations. The first motivating example given on page 2 provides a program to reverse a list, building up the result in an accumulator.</p>

<p><div>
<pre class="haskell"><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> :: List a -&gt; List a -&gt; List a
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> ls acc = <span style="color: #06c; font-weight: bold;">if</span> nil ls
                    <span style="color: #06c; font-weight: bold;">then</span> acc
                    <span style="color: #06c; font-weight: bold;">else</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span style="font-weight: bold;">tail</span></a> ls<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>cons <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span style="font-weight: bold;">head</span></a> ls<span style="color: green;">&#41;</span> acc<span style="color: green;">&#41;</span></pre>
</div></p>

<p>The standard list destructors <code>head</code> and <code>tail</code> are partial functions. They are not defined for the empty list and will produce a runtime error if accidentally applied to the empty list. For this reverse function we can be reasonably certain that it won&#8217;t blow up at runtime, but it&#8217;s a very simple function and we can&#8217;t get the same assurances in all situations. Let&#8217;s call these standard <code>head</code> and <code>tail</code> functions by more explicit names:</p>

<p><div>
<pre class="haskell">unsafeHead :: List a -&gt; a
unsafeTail :: List a -&gt; List a</pre>
</div></p>

<p>In order to provide static guarantees that all uses of <code>head</code> and <code>tail</code> are safe a new type called <code>FullList</code> is introduced which is a rebranded standard list type. The key element is that <code>head</code> and <code>tail</code> can only operate on <code>FullList</code> types, and a guarantee is provided that values in this type are non-empty lists. With this static assurance we can actually use our unsafe functions from earlier:</p>

<p><div>
<pre class="haskell"><span style="color: #5d478b; font-style: italic;">-- unfull converts a FullList to an ordinary List type</span>
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span style="font-weight: bold;">head</span></a> :: FullList a -&gt; a
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span style="font-weight: bold;">head</span></a> = unsafeHead . unfull
&nbsp;
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span style="font-weight: bold;">tail</span></a> :: FullList a -&gt; List a
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span style="font-weight: bold;">tail</span></a> = unsafeTail . unfull</pre>
</div></p>

<p>The <code>FullList</code> type becomes a one-use token which the value has when it moves through the program. This token can only be created in one place (which we can lock inside a separate module). We can easily control under what conditions this token is assigned:</p>

<p><div>
<pre class="haskell"><span style="color: #06c; font-weight: bold;">module</span> <span style="color: green;">&#40;</span>FullList, unFull, full<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">where</span>
&nbsp;
<span style="color: #06c; font-weight: bold;">newtype</span> FullList a = Full <span style="color: green;">&#123;</span> unFull :: List a <span style="color: green;">&#125;</span>
&nbsp;
full :: List a -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe"><span style="color: #cccc00; font-weight: bold;">Maybe</span></a> <span style="color: green;">&#40;</span>FullList a<span style="color: green;">&#41;</span>
full ls = <span style="color: #06c; font-weight: bold;">if</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:null"><span style="font-weight: bold;">null</span></a> ls <span style="color: #06c; font-weight: bold;">then</span> Nothing <span style="color: #06c; font-weight: bold;">else</span> Just <span style="color: green;">&#40;</span>Full ls<span style="color: green;">&#41;</span></pre>
</div></p>

<p>To verify that <code>head</code> and <code>tail</code> are always &#8220;safe&#8221; we must only verify that a <code>FullList</code> is always non-empty. The paper goes deeper into the formal verification than I&#8217;m comfortable talking about (at least at the moment) but it should be reasonable to say that there is only one line of code, the definition of <code>full</code>, which needs examined.</p>

<p>This is the <em>kernel of trust</em> concept that the paper revolves around. Shrinking down this kernel means it&#8217;s easier to examine and verify; and from there the type system extends our trust to the rest of the program.</p>

<p>From the user perspective, the type system forces us to check that lists are not empty before invoking <code>head</code> or other unsafe list operations:</p>

<p><div>
<pre class="haskell"><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> :: List a -&gt; List a -&gt; List a
<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> xs acc = <span style="color: #06c; font-weight: bold;">case</span> full xs <span style="color: #06c; font-weight: bold;">of</span>
            Nothing -&gt; acc
            Just ls -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:reverse"><span style="font-weight: bold;">reverse</span></a> <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:tail"><span style="font-weight: bold;">tail</span></a> ls<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>cons <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"><span style="font-weight: bold;">head</span></a> ls<span style="color: green;">&#41;</span> acc<span style="color: green;">&#41;</span></pre>
</div></p>

<p>Ideally we&#8217;d be doing this <em>anyway</em> so there isn&#8217;t a greater burden &#8212; but it does provide us with compilation errors if we forget to do it. (From personal experience the use of an option type like <code>Maybe</code> makes it much harder to forget these things, even before getting the compiler error. And calling <code>fromJust</code> or other unsafe extraction method feels immoral.)</p>

<p>This takes us up to Section 2.1, with only one omission. The paper at this point switches from explicit wrapping and unwrapping of option types to continuation-passing style. The option types are straightforward but slow things down. Depending on how things go I might follow suit and use continuation-passing from here on, but it might prove a better learning experience to convert to option types. We&#8217;ll see when I come to write up the next section.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougalstanton.net/blog/index.php/2011/01/16/a-look-at-lightweight-static-capabilities-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

