<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
<channel>
  <title>Beware of the Train</title>
  <link>http://pozorvlak.livejournal.com/</link>
  <description>Beware of the Train - LiveJournal.com</description>
  <lastBuildDate>Fri, 16 May 2008 13:36:47 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>pozorvlak</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>http://p-userpic.livejournal.com/40723156/8930234</url>
    <title>Beware of the Train</title>
    <link>http://pozorvlak.livejournal.com/</link>
    <width>100</width>
    <height>80</height>
  </image>

<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/103855.html</guid>
  <pubDate>Fri, 16 May 2008 13:36:47 GMT</pubDate>
  <title>Lazy lists, impatience and hubris</title>
  <link>http://pozorvlak.livejournal.com/103855.html</link>
  <description>There was a recent &lt;a href=&quot;http://article.gmane.org/gmane.comp.lang.haskell.cafe/39806&quot;&gt;mailing list post&lt;/a&gt; by Andrew Coppin (which received &lt;a href=&quot;http://reddit.com/info/6j6zw/comments/&quot;&gt;some discussion on programming.reddit&lt;/a&gt;) in which he bemoans the way that GHC, when presented with reasonable-looking code, can suddenly and mysteriously decide that it needs to allocate gigabytes of memory, slowing your system to a crawl for ages (I&apos;ve had &lt;a href=&quot;http://pozorvlak.livejournal.com/70807.html&quot;&gt;similar&lt;/a&gt; &lt;a href=&quot;http://pozorvlak.livejournal.com/55568.html&quot;&gt;problems&lt;/a&gt; myself). Andrew&apos;s example was the following:&lt;blockquote&gt;&lt;br /&gt;I offer up the following example:&lt;pre&gt;mean xs = sum xs / length xs&lt;/pre&gt; Now try, say, &lt;tt&gt;mean [1.. 1e9]&lt;/tt&gt;, and watch GHC eat several GB of RAM. (!!)&lt;/blockquote&gt; This is not so mysterious when you remember that Haskell uses linked lists as its native list structure, and so the only way to calculate &lt;tt&gt;length xs&lt;/tt&gt; is to traverse the list a second time: the runtime system &quot;helpfully&quot; keeps around the copy of &lt;tt&gt;xs&lt;/tt&gt; that it generated while calculating &lt;tt&gt;sum xs&lt;/tt&gt;, and you have a space leak. But what to do about it?&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;Andrew suggests the rather eye-watering &lt;pre&gt;mean = (\(s,n) -&amp;gt; s / n) . foldr (\x (s,n) -&amp;gt; let s&apos; = s+x; n&apos; = n+1 
    in s&apos; `seq` n&apos; `seq` (s&apos;, n&apos;)) (0,0)&lt;/pre&gt; Stare at that for a while, and let your eyes de-focus: after a while, it becomes apparent that he&apos;s fused the two traversals of the list into one. All that &lt;tt&gt;seq&lt;/tt&gt; business is, er, something to do with strictness, I dunno. &lt;a href=&quot;http://smuglispweeny.blogspot.com/2008/03/tiltons-law-of-programming-fear-no-evil_09.html&quot;&gt;Tilton&apos;s Law of Programming&lt;/a&gt; applies here. Anyway, Don Stewart&apos;s written a &lt;a href=&quot;http://cgi.cse.unsw.edu.au/~dons/blog/2008/05/16#fast&quot;&gt;good article&lt;/a&gt; showing how to get to the fast version of the code from the slow version, including some handy tips on reading intermediate compiler output to see what&apos;s really going on. It&apos;s a bit disingenuous, though - he shows that allocating the list strictly will consume over 8GB, and concludes that &quot;Strictness is not the solution here&quot;, whereas from what I can see, this is the only part of the program where strictness &lt;i&gt;doesn&apos;t&lt;/i&gt; help! It &lt;a href=&quot;http://reddit.com/r/programming/info/6jjhg/comments/c040xiv&quot;&gt;appears&lt;/a&gt; &lt;a href=&quot;http://reddit.com/r/programming/info/6jjhg/comments/c040xke&quot;&gt;that&lt;/a&gt; recent versions of GHC do a lot of strictness analysis when given the -O flag, and here that&apos;s enough. But there&apos;s a lot of good stuff in there, and I shall refer back to it next time my Haskell code performs surprisingly (although I must say, the last time I heard of anyone inspecting intermediate compiler output to get adequate performance was in the late 80s on early Ada compilers...).&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid2&quot;&gt;&lt;/a&gt;Anyway, that&apos;s not what I wanted to talk about. As part of a &lt;a href=&quot;http://reddit.com/info/6j6zw/comments/c03ztjv&quot;&gt;very silly discussion&lt;/a&gt; prompted by Andrew&apos;s post, someone challenged me to &quot;provide, in the strict language of [my] choice -- any language at all, as long as it is strict -- a function that calculates the mean of a list of doubles that correctly produces the mean of [1 .. 10e9] in constant space&quot;.&lt;br /&gt;&lt;br /&gt;Now, one could argue that 8GB is a constant amount of space (albeit a large one), and write a version that simply allocated the list directly. But that would miss the point, because the challenge is actually very easy. Sure, if you want to consume a sensible amount of memory and yet retain genericity, you&apos;re going to need to generate the list lazily. But what my challenger had forgotten is that one can easily hand-roll lazy data-structures in any language with lexical closures or, come to that, objects. Which is to say, in any reasonably modern language. I chose Perl, because it&apos;s the strict language I know best:&lt;pre&gt;    sub mean {
            my $getnext=shift; my ($next, $done, $sum, $count);
            while (!$done) {
                    ($next, $done) = $getnext-&amp;gt;();
                    $sum += $next; $count++
            }
            return $sum/$count;
    }
    my $i = 1; print mean( sub { ($i++, $i&amp;gt;1000000000); } );&lt;/pre&gt; Now, that code&apos;s by no means fast: in fact, it took over half-an-hour to complete on my girlfriend&apos;s aging laptop. But it fulfilled the &quot;constant space&quot; part of the spec admirably, consuming about 1.5MB consistently (almost all of that for the Perl interpreter).&lt;br /&gt;&lt;br /&gt;What&apos;s going on there? Well, instead of accepting a list, my &lt;tt&gt;mean&lt;/tt&gt; function accepts an iterator: a closure that, when called, returns a pair containing the next element of the list and a boolean saying whether we&apos;ve reached the end yet (the keyword &lt;tt&gt;sub&lt;/tt&gt;, as well as declaring named functions, creates anonymous coderefs which can access variables in their surrounding lexical scope: in effect, it&apos;s Perl&apos;s &lt;tt&gt;lambda&lt;/tt&gt;). This iterator may not look very listlike at first glance, but it does the same thing: conceptually, therefore, it&apos;s a list. Someone, probably Duncan Coutts, once suggested to me that the best way to think about Haskell&apos;s lazy lists is as forward-only iterators over collections: implementing a &lt;tt&gt;toList&lt;/tt&gt; function for your new data structure is conceptually just like building an iterator, as the next part of the list is only built when it&apos;s asked for (which is equivalent to calling &lt;tt&gt;next()&lt;/tt&gt; on an iterator in Java or C++). I&apos;ve found this approach very helpful.&lt;br /&gt;&lt;br /&gt;This (next_elt, done?) approach isn&apos;t the only way of making lazy lists, but it&apos;s a perfectly sensible one. One could generalise the way we&apos;ve created the list (1..1e9):&lt;pre&gt;sub make_stream {
    my $i = shift; my $upper = shift; my $step = shift || 1;
    $i -= $step;
    return sub { $i += step; ($i, $i &amp;gt;= $upper) };
}&lt;/pre&gt; or wrap an honest-to-God Perl list:&lt;pre&gt;sub stream { my $i; my @xs = @_; sub { ($xs[$i++], $i &amp;gt; $#xs) }
mean(stream(1,2,3,7, -32.6 10**3.7))&lt;/pre&gt; The general form is &lt;pre&gt;# set up lexicals here
my $stream = sub { return (
    # calculation to get next element; probably mutates state
    ,
    # are we done yet?
    )
}&lt;/pre&gt;As funktio suggested, you&apos;d probably want to wrap the lexicals in either a &lt;tt&gt;do&lt;/tt&gt;-block or a function like &lt;tt&gt;make_stream&lt;/tt&gt; above.&lt;br /&gt;&lt;br /&gt;What else could we have done? Another option would have been to create an object with &lt;tt&gt;next&lt;/tt&gt; and &lt;tt&gt;end&lt;/tt&gt; methods, and store any necessary state as a member variable of the object. The most standard solution would have been to create a coderef that returned &lt;tt&gt;(car, cdr)&lt;/tt&gt; pairs, where &lt;tt&gt;car&lt;/tt&gt; is the next element of the list, and &lt;tt&gt;cdr&lt;/tt&gt; is another coderef which, when evaluated, returns the &lt;i&gt;next&lt;/i&gt; &lt;tt&gt;(car, cdr)&lt;/tt&gt; pair. This, incidentally, is how Haskell&apos;s laziness works under the hood: unevaluated values are stored as closures called &quot;thunks&quot;, which, when called, return the value you want. If you never need the value, the thunk is never called, and so the calculation&apos;s never done. In Perl, this looks like:&lt;pre&gt;sub range {
    my $lower = shift; my $upper = shift; my $step = shift || 1;
    my $test = ($lower &amp;gt;= $upper, 1, $lower &amp;lt;= $upper)[($step &amp;lt;=&amp;gt; 0) + 1];
    my $cdr = $test ? sub { range($lower + $step, $upper, $step) } : undef;
    return ($lower, $cdr);
}

sub range_to_list {
    my ($car, $cdr) = @_;
    my @list;
    while (defined($cdr)) {
        push @list, $car;
        ($car, $cdr) = $cdr-&amp;gt;();
    }
    return @list;
}&lt;/pre&gt; In practice, you should use one of the &lt;a href=&quot;http://www.google.com/search?ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;q=lazy+list+site%3Acpan.org&quot;&gt;lazy list modules on CPAN&lt;/a&gt;. I&apos;ve never used any of them, but &lt;a href=&quot;http://search.cpan.org/~genie/Tie-LazyList-0.05/LazyList.pm&quot;&gt;Tie::LazyList&lt;/a&gt;, which lets you use lazy lists like they were ordinary Perl lists, looks good.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid3&quot;&gt;&lt;/a&gt;We&apos;re almost done, but there&apos;s something else I&apos;d like to look at. What would all this look like in Ruby? Well, one could easily do what we&apos;ve just done: Ruby&apos;s anonymous blocks fulfil the same role as Perl&apos;s coderefs. But the more natural approach, I think, is the reverse of ours: You&apos;d define a Range class which has an &lt;tt&gt;each&lt;/tt&gt; method, and then define &lt;tt&gt;mean&lt;/tt&gt; by passing a callback to &lt;tt&gt;each&lt;/tt&gt;:&lt;pre&gt;def mean(lst)
    sum = 0
    count = 0
    lst.each do |x|
        sum += x
        count += 1
    end
    sum / count
end&lt;/pre&gt; Then &lt;tt&gt;each&lt;/tt&gt; could provide an iterator in any way appropriate, which probably wouldn&apos;t keep the list in memory. Even if we did two traversals of the list, we wouldn&apos;t run out of RAM. As a bonus, our mean function now works on any object which implements &lt;tt&gt;each&lt;/tt&gt;, so it&apos;s approximately as general as the Haskell version. By the way, does anyone know how Ruby&apos;s ranges work internally?&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid4&quot;&gt;&lt;/a&gt;So, the take-home messages:&lt;ul&gt;&lt;li&gt;While laziness is cool, it&apos;s not actually that magical, and you don&apos;t have to be using Haskell to take advantage of it: you can implement your own lazy data-structures in a few lines of any modern language. What Haskell brings to the table is &lt;i&gt;pervasive&lt;/i&gt; laziness, so all the standard functions will work as-is with lazy structures, and dividing code into producer/consumer pairs is easier.&lt;/li&gt;&lt;li&gt; Perl has full lexical closures, and all that follows from them.&lt;br /&gt;[If you haven&apos;t had a look at Mark Jason Dominus&apos; book &lt;a href=&quot;http://hop.perl.plover.com/&quot;&gt;Higher-Order Perl&lt;/a&gt; yet, then now would be a good time. It&apos;s a free read online, and also available in dead tree format. And be sure to read the &lt;a href=&quot;http://hop.perl.plover.com/cover.html&quot;&gt;lovely story&lt;/a&gt; associated with the cover.]&lt;/li&gt;&lt;li&gt;A good way to think of lazy lists in Haskell is as forward-only iterators.&lt;/li&gt;&lt;li&gt;Callbacks Are Your Friends, and widely-supported APIs (like Ruby&apos;s Enumerable API) are also your friends.&lt;/li&gt;&lt;li&gt;If you&apos;re doing anything numerical with Haskell, you probably want to be giving the &lt;tt&gt;-O&lt;/tt&gt; or &lt;tt&gt;-O2&lt;/tt&gt; flag to GHC!&lt;/li&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/ul&gt;</description>
  <comments>http://pozorvlak.livejournal.com/103855.html</comments>
  <category>computers</category>
  <category>programming</category>
  <category>beware the geek</category>
  <category>perl</category>
  <category>ruby</category>
  <category>haskell</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/103579.html</guid>
  <pubDate>Wed, 14 May 2008 12:25:24 GMT</pubDate>
  <title>Sage</title>
  <link>http://pozorvlak.livejournal.com/103579.html</link>
  <description>Those of you who do scientific computation may be interested in this link:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://vnoel.wordpress.com/2008/05/03/bye-matlab-hello-python-thanks-sage/&quot;&gt;Bye Matlab, hello Python, thanks Sage.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Short version: Sage is a bundle of all of the various numeric/scientific/graphing tools for Python, made easy to download and install (even if you don&apos;t have root access, apparently). According to the blogger linked above, it&apos;s now good enough to serve as a replacement for Matlab (and it has ambitions to be a replacement for Maple and Mathematica too, though I don&apos;t know how far along it is). It integrates with R, Gap, etc. And because it&apos;s Python, you get a real, high-level, well-designed programming language with a proper environment to do your coding in.&lt;br /&gt;&lt;br /&gt;In other news, &lt;span class=&apos;ljuser&apos; lj:user=&apos;wormwood_pearl&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/&apos;&gt;&lt;b&gt;wormwood_pearl&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; finished her Finals yesterday. As you can imagine, we&apos;re both pretty relieved. There&apos;s no tradition of meeting people outside Finals here like there is in Oxford, but I went along with a bottle of champagne anyway - and only then remembered that public drinking is against Glasgow bylaws. Drat it. We went out to lunch, the bottle went into the Department fridge, and we subsequently went round to her sisters&apos; and drank it there while watching &lt;i&gt;Layer Cake&lt;/i&gt;. Because we&apos;re &lt;i&gt;that&lt;/i&gt; exciting.</description>
  <comments>http://pozorvlak.livejournal.com/103579.html</comments>
  <category>computers</category>
  <category>programming</category>
  <category>links</category>
  <category>python</category>
  <category>science</category>
  <category>relationships</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/103349.html</guid>
  <pubDate>Fri, 09 May 2008 16:58:42 GMT</pubDate>
  <title>Notation that sings</title>
  <link>http://pozorvlak.livejournal.com/103349.html</link>
  <description>Some Actual Maths for a change. Some of it assumes some mathematical sophistication, but the core idea should be accessible to anybody. Have you ever been an arts student? I&apos;m looking at you. Skate over the words you don&apos;t know, they&apos;re not important - they&apos;re just there to explain how the central result connects to more sophisticated and deeper areas of mathematics.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;Over at the &lt;a href=&quot;http://comonad.com/reader/2008/just-fokkinga-abide/&quot;&gt;Comonad.Reader&lt;/a&gt;, Edward Kmett&apos;s been writing about so-called &quot;abiding&quot; pairs of binary operations: we say that * and + &lt;b&gt;abide&lt;/b&gt; if (a+b)*(c+d) = (a*c)+(b*d) for all a, b, c and d. The term&apos;s a portmanteau of &quot;above and beside&quot;, and comes from the following rather lovely notation:&lt;pre&gt;
a|c = (a*b)+(c*d)
-|-              
b|d              

a|c = (a+c)*(b+d)
---
b|d&lt;/pre&gt; We write * by stacking things vertically, and + by putting them side-by-side: then + and * abide if we can remove the lines without introducing ambiguity. By the way, + and * don&apos;t necessarily stand for ordinary addition and multiplication - in fact, they can&apos;t, because addition and multiplication don&apos;t abide! Just think of them as two machines: you feed two &lt;i&gt;things&lt;/i&gt; into either of them, and get one &lt;i&gt;thing&lt;/i&gt; out of the other end. We require the things we get back to satisfy the equation above (and yes, there are examples).&lt;br /&gt;&lt;br /&gt;Why would we want to consider such a thing? Well, suppose (A,+,0) is a monoid: then one of the conditions we need for * to be a monoid homomorphism AxA -&amp;gt; A is that * and + abide. Generalise that example as far as you wish :-)&lt;br /&gt;&lt;br /&gt;Though neither Edward&apos;s post nor the thesis he links to say so, this notation is related to the rather beautiful &lt;a href=&quot;http://en.wikipedia.org/wiki/Eckmann-Hilton_argument&quot;&gt;Eckmann-Hilton argument&lt;/a&gt;. I tried to say as much in a comment, but the proof works best in two dimensions, and his comment form strips &amp;lt;pre&amp;gt; tags. Fortunately, however, I have no such restriction here :-)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Theorem&lt;/b&gt; (Eckmann-Hilton): Let +, * be a pair of abiding binary operations on a set A, with units 0 and 1 respectively (so a+0 = a = 0+a and a*1 = a = 1*a for all a). Then 0 = 1, + = *, and + (and hence *) is commutative.&lt;br /&gt;&lt;b&gt;Proof&lt;/b&gt;:&lt;pre&gt;
0 = 0|0 = 1|0 = 1|0 = 1 = 1
          -|-   ---   -
          0|1   0|1   1

x|y = 1|y = 1|y = y = y|1 = y|1 = y|x = 1|x = 1|x = x
      -|-   ---   -   ---   -|-         -|-   ---   -
      x|1   x|1   x   1|x   1|x         y|1   y|1   y&lt;/pre&gt;QED.&lt;br /&gt;&lt;br /&gt;You&apos;ll note that this chain of equations can be continued so that it loops round back to x+y again. If you do that, and arrange the stages in the proof in a circle, you get the &quot;&lt;a href=&quot;http://cheng.staff.shef.ac.uk/degeneracy/eggclock.pdf&quot;&gt;Eckmann-Hilton clock&lt;/a&gt;&quot;.&lt;br /&gt;&lt;br /&gt;This, by the way, is the kind of thing I mean when I say I do &quot;higher-dimensional algebra&quot;: some arguments naturally live in more than one dimension. In 2-d we&apos;re OK, because we can draw pictures on paper, but 3-d and higher rapidly gets hard to think about.&lt;br /&gt;&lt;br /&gt;The Eckmann-Hilton argument originally arose in algebraic topology: it&apos;s how you prove that the higher homotopy groups &amp;pi;&lt;small&gt;&lt;sub&gt;2&lt;/sub&gt;&lt;/small&gt;, &amp;pi;&lt;small&gt;&lt;sub&gt;3&lt;/sub&gt;&lt;/small&gt; must be commutative (the notation now has a geometric interpretation: we can literally lay out homotopies and morph them around each other as in the proof). In category theory, the argument is widespread, and it&apos;s related to the &lt;a href=&quot;http://math.ucr.edu/home/baez/week121.html&quot;&gt;Stabilization Hypothesis&lt;/a&gt; (scroll down until you see the table, then read the paragraph or two above for the gist). A further example is the theorem that a monoid object in the category of monoids is a commutative monoid (because, as mentioned above, a monoid homomorphism AxA-&amp;gt;A must abide with the binary operation on A).&lt;br /&gt;&lt;br /&gt;I first encountered the Eckmann-Hilton argument in &lt;a href=&quot;http://mat.uab.es/~kock/&quot;&gt;Joachim Kock&lt;/a&gt;&apos;s excellent book &lt;a href=&quot;http://mat.uab.es/~kock/TQFT.html&quot;&gt;Frobenius algebras and 2D topological quantum field theories&lt;/a&gt;, which despite the title is a great introduction to the categorical way of thinking. It&apos;s aimed at beginning graduate students, is as easy to read as a maths textbook will ever be, and comes highly recommended. It&apos;s also interesting for the way the book&apos;s structured: it uses the &lt;a href=&quot;http://www.paulgraham.com/progbot.html&quot;&gt;bottom-up style&lt;/a&gt; currently in fashion in programming circles. The book introduces a series of &quot;languages&quot;, each defined in terms of the previous one, which approach successively closer to the material in question. By the end of the book, we&apos;re able to replace literally pages of calculation with a few simple diagrams, &lt;i&gt;and it&apos;s all perfectly rigorous&lt;/i&gt;. Better than that, the graphical language makes proofs extremely easy to construct. The main result of the book&apos;s pretty cute too :-)</description>
  <comments>http://pozorvlak.livejournal.com/103349.html</comments>
  <category>books</category>
  <category>maths</category>
  <category>links</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/103121.html</guid>
  <pubDate>Thu, 08 May 2008 13:24:55 GMT</pubDate>
  <title>LOLhacker?</title>
  <link>http://pozorvlak.livejournal.com/103121.html</link>
  <description>I know I&apos;m very late to the LOL$thing party, but what the hell:&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://mine.icanhascheezburger.com/view.aspx?ciid=1102583&quot;&gt;&lt;img src=&quot;http://images.icanhascheezburger.com/completestore/2008/5/8/iminurcompilu128547258062322500.jpg&quot; alt=&quot;im in ur compilur fuzin ur lazy streemz&quot; /&gt;&lt;/a&gt;&lt;br /&gt;moar &lt;a href=&quot;http://icanhascheezburger.com&quot;&gt;allegedly funny pictures&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://mine.icanhascheezburger.com/view.aspx?ciid=1102597&quot;&gt;&lt;img src=&quot;http://images.icanhascheezburger.com/completestore/2008/5/8/refrnshltranzpa128547262873447500.jpg&quot; alt=&quot;refrnshl transparensee iz no larfin mattur&quot; /&gt;&lt;/a&gt;&lt;br /&gt;moar &lt;a href=&quot;http://icanhascheezburger.com&quot;&gt;allegedly funny pictures&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, I reckon about half of you will recognise the guy in the pictures, and about half will understand the captions. I&apos;m interested to know how large the intersection is...</description>
  <comments>http://pozorvlak.livejournal.com/103121.html</comments>
  <category>light entertainment</category>
  <category>computers</category>
  <category>programming</category>
  <category>memes</category>
  <category>beware the geek</category>
  <category>links</category>
  <category>haskell</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/102874.html</guid>
  <pubDate>Wed, 07 May 2008 22:52:03 GMT</pubDate>
  <title>Thesis sitrep</title>
  <link>http://pozorvlak.livejournal.com/102874.html</link>
  <description>I&apos;ve been collecting some more data on the thesis:&lt;pre&gt;Wed May  7 23:45:49 BST 2008
4741 lines 23246 words 163656 characters
thesis.log:Output written on thesis.dvi (84 pages, 643096 bytes).
33 fixmes
80 definitions
141 term-definitions
24 theorems
21 lemmas
6 corollaries
30 examples
143 bullet-points&lt;/pre&gt; A &quot;term-definition&quot; is a call to the macro &lt;tt&gt;\defterm&lt;/tt&gt;, which I use to emphasize the term being defined. The count&apos;s not the same as the number of definitions because I often group the definitions of related terms into the same &lt;tt&gt;\begin{defn}...\end{defn}&lt;/tt&gt; block. The lemmas, theorems etc are mostly other people&apos;s :-(&lt;br /&gt;&lt;br /&gt;I like bullet points. They reflect how I think, and bullet-pointed text takes up more space on the page.</description>
  <comments>http://pozorvlak.livejournal.com/102874.html</comments>
  <category>computers</category>
  <category>thesis</category>
  <category>tex</category>
  <category>maths</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/102599.html</guid>
  <pubDate>Wed, 07 May 2008 22:43:36 GMT</pubDate>
  <title>In case you were wondering how I got this way...</title>
  <link>http://pozorvlak.livejournal.com/102599.html</link>
  <description>The tail-end of a conversation with my Dad last night:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;[A discussion of scary-sounding nonlinear dynamical techniques my Dad has been studying, with Poincar&amp;eacute;&apos;s name attached for extra scariness]&lt;/i&gt;&lt;br /&gt;&lt;b&gt;Me&lt;/b&gt;: Sounds interesting. Have you come across the idea of considering the Poisson bracket as a symplectic form on the cotangent bundle of phase space?*&lt;br /&gt;&lt;b&gt;Dad&lt;/b&gt;: No, I don&apos;t think so...&lt;br /&gt;&lt;b&gt;Me&lt;/b&gt;: Something like that, anyway. I went to enough lectures on this stuff to pick up the jargon, but not enough to really get my head around it.&lt;br /&gt;&lt;b&gt;Dad&lt;/b&gt;: Yes, I know that feeling.&lt;br /&gt;&lt;b&gt;Me&lt;/b&gt;: But it&apos;s interesting how quickly physics becomes geometrical, isn&apos;t it?&lt;br /&gt;&lt;b&gt;Dad&lt;/b&gt;: Yes, certainly. You know, one of these days you and I should put our heads together and try to properly understand General Relativity.&lt;br /&gt;&lt;b&gt;Me&lt;/b&gt;: Actually, that was my plan for after I hand in my thesis. That, and learning to ride a unicycle.&lt;br /&gt;&lt;b&gt;Dad&lt;/b&gt;: &lt;i&gt;[laughs]&lt;/i&gt; ...and learn a foreign language and a musical instrument.&lt;br /&gt;&lt;b&gt;Me&lt;/b&gt;: &lt;i&gt;thinks: I wasn&apos;t going to tell him about that bit...&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;small&gt;* My office-mate, who does The Physics, tells met that I meant &quot;configuration space&quot; - phase space &lt;i&gt;is&lt;/i&gt; the cotangent bundle of configuration space!&lt;/small&gt;</description>
  <comments>http://pozorvlak.livejournal.com/102599.html</comments>
  <category>maths</category>
  <category>science</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/102376.html</guid>
  <pubDate>Sun, 04 May 2008 18:04:37 GMT</pubDate>
  <title>Fine Structure: The Story So Far</title>
  <link>http://pozorvlak.livejournal.com/102376.html</link>
  <description>There&apos;s a new &lt;i&gt;Fine Structure&lt;/i&gt; story up, called &lt;a href=&quot;http://qntm.org/index.php?story&quot;&gt;The Story So Far&lt;/a&gt;. Go read it. Actually, there&apos;s another one that I never got round to posting about, called &lt;a href=&quot;http://qntm.org/index.php?failure&quot;&gt;Failure Mode&lt;/a&gt;, which is... rather moving, actually. Great stuff.&lt;br /&gt;&lt;br /&gt;Anyway, the missing story &lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;has now been revealed, and I &lt;a href=&quot;http://pozorvlak.livejournal.com/93585.html&quot;&gt;was right&lt;/a&gt;! Ph34r my l33t story-prediction sk1llz!!!&lt;br /&gt;&lt;br /&gt;Perhaps most interestingly, this (and Sam&apos;s announcement in the comments section of TSSF) mean that &lt;i&gt;Being God is  a Big Responsibility&lt;/i&gt; &lt;b&gt;isn&apos;t&lt;/b&gt; part of FS. So we can rule out all the theories about the world being a quantum simulation. Though something of the layered universe concept seems to have survived.&lt;br /&gt;&lt;br /&gt;I&apos;m not going to write too much now, because I have a hangover. But I think there&apos;d be some benefit to thinking harder about the fictional physics - I definitely should have spotted the &quot;superlight&quot; connection. I think there may be more insights to come from that source.&lt;br /&gt;&lt;br /&gt;There&apos;s now a comments system on the &lt;i&gt;Fine Structure&lt;/i&gt; pages themselves, which I suspect will largely replace the discussions here. Please continue to comment on my posts if you want, though! I&apos;m hoping someone else will start blogging in depth about FS. Maybe we need a &lt;i&gt;Fine Structure&lt;/i&gt; wiki? An E2 node?</description>
  <comments>http://pozorvlak.livejournal.com/102376.html</comments>
  <category>fine structure</category>
  <category>books</category>
  <category>sf</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/102020.html</guid>
  <pubDate>Sat, 03 May 2008 19:38:00 GMT</pubDate>
  <title>Floreat gens togata</title>
  <link>http://pozorvlak.livejournal.com/102020.html</link>
  <description>I see that Londoners have chosen &lt;a href=&quot;http://news.bbc.co.uk/1/hi/uk_politics/7381585.stm&quot;&gt;the devil they don&apos;t know&lt;/a&gt; in place of the devil they do. I shall observe my fellow KS&apos;s future performance with considerable interest, and at a distance of several hundred miles.&lt;br /&gt;&lt;br /&gt;In other news, my flatmates are looking to move to Oxford in the next few months (Nicola&apos;s starting an MSc) - can anyone offer some hints on Oxford flathunting? I was a wuss, and stayed in college accommodation for all four years, so can&apos;t be too much use.</description>
  <comments>http://pozorvlak.livejournal.com/102020.html</comments>
  <category>oxford</category>
  <category>politics</category>
  <category>school</category>
  <category>lazyweb</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/101784.html</guid>
  <pubDate>Wed, 30 Apr 2008 03:07:28 GMT</pubDate>
  <title>Mountain photos</title>
  <link>http://pozorvlak.livejournal.com/101784.html</link>
  <description>I&apos;ve put a selection of photos from my last-but-one hiking trip on moblog: &lt;a href=&quot;http://moblog.co.uk/view.php?id=325901&quot;&gt;part 1&lt;/a&gt;, &lt;a href=&quot;http://moblog.co.uk/view.php?id=325906&quot;&gt;part 2&lt;/a&gt;, &lt;a href=&quot;http://moblog.co.uk/view.php?id=325907&quot;&gt;part 3&lt;/a&gt;. We went to Glen Etive (south and a bit west of Glen Coe), and climbed Ben Starav and Beinn nan Aighenan - the plan had been to do more, but we underestimated the time it would take and overestimated our fitness levels. It was an absolutely stunning day, and the scenery was just great. A sample:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src=&quot;http://moblog.co.uk/blogs/1118/moblog_7c3bac6e114a2.jpg&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://moblog.co.uk/blogs/1118/moblog_665ad38f786b7.jpg&quot;&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;By the way, my thesis page-count has finally drawn level with my Munro-bagging count:&lt;br /&gt;&lt;br /&gt;Wed Apr 30 04:06:10 BST 2008&lt;br /&gt;4552 lines 22350 words 156883 characters&lt;br /&gt;thesis.log:Output written on thesis.dvi (82 pages, 628596 bytes).&lt;br /&gt;34 fixmes&lt;br /&gt;&lt;br /&gt;Yay!</description>
  <comments>http://pozorvlak.livejournal.com/101784.html</comments>
  <category>thesis</category>
  <category>mountains</category>
  <category>munros</category>
  <category>photography</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/101394.html</guid>
  <pubDate>Tue, 29 Apr 2008 15:44:16 GMT</pubDate>
  <title>This is a test</title>
  <link>http://pozorvlak.livejournal.com/101394.html</link>
  <description>=pod&lt;br /&gt;&lt;br /&gt;... do not be alarmed.&lt;br /&gt;&lt;br /&gt;What happened was that I was &lt;a href=&quot;http://reddit.com/info/6hi14/comments/c03uux0&quot;&gt;talking on Reddit with Masklinn&lt;/a&gt; about &lt;a href=&quot;http://en.wikipedia.org/wiki/Literate_Programming&quot;&gt;Literate Programming&lt;/a&gt;, and s/he wanted to know if there were any systems other than Literate Haskell which allowed for &lt;a href=&quot;http://sigfpe.blogspot.com/2008/04/infinitesimal-rotations-and-lie.html&quot;&gt;blog posts which are valid code&lt;/a&gt;. &quot;Hrmmm,&quot; I thought, &quot;I don&apos;t see any obstacle to &lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;doing that with &lt;a href=&quot;http://en.wikipedia.org/wiki/Plain_Old_Documentation&quot;&gt;POD&lt;/a&gt;...&quot;&lt;br /&gt;&lt;br /&gt;[Yes, my inner monologue does contain hyperlinks. :-) ]&lt;br /&gt;&lt;br /&gt;Literate Programming, by the way, is a workaround for the limitations of early Pascal compilers encountered by Donald Knuth when he was writing TeX. The bit everyone remembers is about intermingling code with a description of that code - a program called &lt;tt&gt;weave&lt;/tt&gt; would then produce TeX source, which could be compiled into a beautifully-typeset manual, and another program called &lt;tt&gt;tangle&lt;/tt&gt; would produce highly portable, lowest-common-denominator Pascal source, which could then be compiled into a runnable program. The original WEB system had many other features to enable higher-level programming without compromising portability: most of these are IMHO considerably less necessary with modern languages, and many of the rest are handled by systems such as Doxygen. Anyway, Literate Haskell handles the &quot;intermingling code with docs&quot; bit for Haskell, and POD does a similar job for Perl. Mark Dominus has written an &lt;a href=&quot;http://www.perl.com/pub/a/tchrist/litprog.html&quot;&gt;article&lt;/a&gt; explaining where POD falls short of Knuth&apos;s WEB system (and of Knuth&apos;s conception of Literate Programming) - as far as I can see, most of it applies to Literate Haskell too. &lt;a href=&quot;http://www.literateprogramming.com/knuthweb.pdf&quot;&gt;Knuth&apos;s original paper&lt;/a&gt; is, well, written by Donald Knuth - obviously it&apos;s worth reading! :-)&lt;br /&gt;&lt;br /&gt;Anyway, having fulfilled Criterion 1 of Literate Programming (start with a long paragraph explaining what LP is and what it&apos;s for, and &lt;i&gt;only then&lt;/i&gt; reveal that - shock, horror! &lt;i&gt;The document you&apos;re reading is in fact a program!&lt;/i&gt;), I should get on with some actual coding.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
=cut

print &quot;Hello, Literate World!\n&quot;;

=pod
&lt;/pre&gt;&lt;br /&gt;Did&apos;ja see that? I &lt;i&gt;totally embedded some code right in my blog post!&lt;/i&gt; Wow. Note that this was the classic &quot;Hello, World&quot; program - by tradition (which in hacker circles has a force greater than physical law and only slightly less than mathematical inevitability), this is the first program you must write with any new system.&lt;br /&gt;&lt;br /&gt;Let&apos;s do something a bit more interesting:&lt;pre&gt;
=cut

while (&amp;lt;&amp;gt;) {
        s/!+/./g; print;
}

=pod
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That accepts some text on standard input (and/or any files specified on the command line), and replaces all sequences of exclamation marks with a single full stop. The result is then placed on standard output. I used to have that as a filter on my incoming mail - we had a very excitable JCR committee, who used to send out lots of emails of the form &quot;Massive event happening tonight!!!!!!! Everyone must come!!!!!&quot;.&lt;br /&gt;&lt;br /&gt;But, uh-oh, there&apos;s a problem - see where it says &lt;tt&gt;while (&amp;lt;&amp;gt;)&lt;/tt&gt;? That&apos;s actually &lt;tt&gt;while (&amp;amp;lt;&amp;amp;gt;)&lt;/tt&gt;, which isn&apos;t valid Perl. But if I didn&apos;t do that, your browser would think I&apos;d included an empty tag, which would disappear silently when your browser tried to render it - not very helpful. The upshot is that you can&apos;t just save this HTML file as &lt;tt&gt;witteringmoron.pl&lt;/tt&gt; and expect it to work - you&apos;ll have to cut-and-paste the body of the post (being sure to get the &lt;tt&gt;=pod&lt;/tt&gt; at the top) and save it separately. Sorry about that. But actually, you needed to do that anyway - the interpreter expects to start off in Perl mode, not POD mode, and all the HTML header gubbins isn&apos;t valid Perl.&lt;br /&gt;&lt;br /&gt;Anyway, let&apos;s try it. Copy... paste into a new text editor window... save as &lt;tt&gt;witteringmoron.pl&lt;/tt&gt;... now, open a command-line and type &lt;tt&gt;perl witteringmoron.pl&lt;/tt&gt;:&lt;pre&gt;Hello, Literate World!&lt;/pre&gt; Excellent. Now, type some sample  input:&lt;pre&gt;This is, like, totally a test!!!!! ZOMG!!!!!!&lt;/pre&gt;This produces the output &lt;pre&gt;This is, like, totally a test. ZOMG.&lt;/pre&gt;Which is correct, albeit somewhat deflating. You can stop the program from asking for more input by typing Ctrl-D.&lt;br /&gt;&lt;br /&gt;So, yeah, you can write blog posts in POD, subject to the above limitations. Woo!&lt;br /&gt;&lt;br /&gt;Right, back to work.</description>
  <comments>http://pozorvlak.livejournal.com/101394.html</comments>
  <category>computers</category>
  <category>programming</category>
  <category>beware the geek</category>
  <category>meta</category>
  <category>perl</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/101155.html</guid>
  <pubDate>Sun, 27 Apr 2008 23:39:32 GMT</pubDate>
  <title>Why I like Perl</title>
  <link>http://pozorvlak.livejournal.com/101155.html</link>
  <description>I wrote this in an email to a colleague of &lt;span class=&apos;ljuser&apos; lj:user=&apos;totherme&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://totherme.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://totherme.livejournal.com/&apos;&gt;&lt;b&gt;totherme&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&apos;s a while back, and have occasionally felt the need to refer to it since. Fortunately, I have a place where I can post my ill-informed ramblings for all the world to see, so here it is :-) It&apos;s an attempt to convince a computer scientist, who I believe comes from the Haskell/static typing camp, why Perl is worth learning.&lt;br /&gt;&lt;br /&gt;[If you&apos;re &lt;i&gt;not&lt;/i&gt; a computer scientist, the two chief reasons to learn Perl are (1) it&apos;s incredibly useful, (2) it&apos;s great fun. But I digress.]&lt;br /&gt;&lt;br /&gt;In many ways, Perl occupies the opposite corner of design-space to Haskell. To a first approximation, Haskell proceeds from the question &quot;what if everything we think we know about language design is right?&quot;, whereas Perl proceeds from the question &lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&quot;what if everything we think we know about language design is wrong?&quot; Consequently, learning Perl is &lt;i&gt;essential&lt;/i&gt; for any student of programming language design. It&apos;s not so obviously revolutionary now, because some of Perl&apos;s design decisions have since become accepted into the conventional wisdom, but there are still some surprises.&lt;br /&gt;&lt;br /&gt;The original author, Larry Wall, was trained as a linguist; consequently, Perl takes inspiration from human languages more than it takes inspiration from mathematics (it&apos;s one of the few programming languages with pronouns, for instance). It also has no hesitation about borrowing good features from other languages: built-in hashes from awk, regular expressions from SNOBOL, Python&apos;s OO features, Lisp&apos;s closures, C&apos;s syntax, Ada&apos;s module system. This leads to a lack of consistency, but consistency is not rated very highly in the Perl community (There&apos;s More Than One Way To Do It). The default assumption is that the programmer (a) is competent, (b) uses the language regularly. Consequently, if there&apos;s a choice between maintaining consistency and providing some useful special case (particularly if it&apos;s a common special case), they&apos;ll often go for the latter. If you need a Perl-like language infrequently, Python occupies roughly the same niche but aims at consistency and simplicity. Python, though, lacks one of Perl&apos;s most interesting and useful features, which might be called implicit type coercion. From a Haskell perspective, if the Python interpreter encounters a type error involving basic types in your code, it will (safely) bug out at runtime with a helpful error message, but the Perl interpreter will attempt to recover by silently applying type coercion functions and continuing. If that sounds dangerous, it&apos;s because I&apos;ve described it from the wrong viewpoint: from a Perl perspective, it means that you can largely ignore variable types when writing code, freeing up your mind to concentrate on your actual algorithm. I&apos;ve written more about this point at &lt;a href=&quot;http://pozorvlak.livejournal.com/47565.html&quot;&gt;http://pozorvlak.livejournal.com/47565.html&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;The assumption that the programmer is competent manifests itself in other ways. One of Perl&apos;s mottos is &quot;easy things should be easy, hard things should be possible&quot;, and so there are few limits on what you can do if you really try (though occasionally the mechanisms involved are a bit grubby and ad-hoc). From a Haskell perspective, this means that Perl code provides few guarantees. It&apos;s therefore essential that you read the documentation, and conversely that you provide good documentation for code that you write (this is considered part of the definition of competence). I read something by Cale Gibbard a while ago about how he&apos;d made a big change to some Haskell module without ever reading the docs, simply by checking that everything compiled and the tests passed. In the Perl world, this would be somewhere between impossible, inconceivable and criminally negligent :-)&lt;br /&gt;&lt;br /&gt;The downside of providing freedom for good coders to do wizardly things is that it makes it possible for bad coders to do stupid things. This is unfortunate. The solution is held to be self-discipline and education, and not hiring bad coders in the first place.&lt;br /&gt;&lt;br /&gt;Perl is the Practical Extraction and Report Language, and a lot of its features are there to help with everyday scripting, data-munging and administration tasks, particularly in a Unix environment. In particular, there are a lot of features there to help with writing &quot;one-liners&quot;. A lot of people say that this makes it unsuitable for writing large programs; this was true for versions 1-4, but version 5 improves the situation here a lot. People can and do write maintainable Perl 5 programs that are hundreds of thousands of lines long. It&apos;s also worth mentioning that you can do a lot more in 1000 lines of Perl than you can in 1000 lines of, say, Java.  If people say negative things about Perl, it&apos;s always worth asking which version they used: if they say 4 or less, you can safely ignore them. Perl 6, a major redesign, has been on the cards for quite a few years now, and it should iron out some of the language&apos;s more irritating quirks while incorporating some nifty things from Haskell and Lisp. Unfortunately, they&apos;re learning the Mozilla Lesson that ground-up rewrites take a lot longer than you&apos;d think. They seem to be making good progress now, though, and some useful Perl 6 features have been &lt;a href=&quot;http://dev.perl.org/perl5/news/2007/perl-5.10.0.html&quot;&gt;incorporated in version 5.10&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;[ykokese from Reddit makes an &lt;a href=&quot;http://reddit.com/info/6haez/comments/c03uaf8&quot;&gt;excellent point&lt;/a&gt;: &quot;I believe learning that you can shoot a problem with a one-liner is important too. I&apos;m not trying to be witty, I truly think that Perl marked the beginning of an era by making it possible to solve problems an order of magnitude faster than before, and indeed introduced the stop-messing-around paradigm.&quot;]&lt;br /&gt;&lt;br /&gt;I should certainly mention CPAN, the Comprehensive Perl Archive Network, which is without doubt the world&apos;s largest collection of open-source user-contributed add-on modules, widely mirrored and with a nifty tool for recursively downloading and installing modules. There is almost always a CPAN module to help with whatever task you are attempting. It might not be &lt;i&gt;good&lt;/i&gt;, mind, but it&apos;s almost certainly going to be easier to start with some CPAN module than roll your own solution. And at their best, CPAN modules are stunningly good (the parser generator Parse::RecDescent springs to mind, here, but there are so many good ones - have a look at Mark Fowler&apos;s &lt;a href=&quot;http://perladvent.pm.org/archives.html&quot;&gt;Perl Advent Calendars&lt;/a&gt; for some more recommendations). Perl&apos;s paradigm-agnosticism helps here, too: if it makes sense for a module to be OO, it can be OO; if it makes sense for it to be functional, it can be functional; if it makes sense for it to be a bunch of imperative procedures, it can be. All in all, it&apos;s the world&apos;s premier laboratory for add-on module design and implementation :-)&lt;br /&gt;&lt;br /&gt;It&apos;s not all roses: Perl definitely has its irritating quirks and defaults-that-shouldn&apos;t-be. A while ago, I tried to think of five things I hated about the language and came up with ten. See &lt;a href=&quot;http://pozorvlak.livejournal.com/49333.html&quot;&gt;http://pozorvlak.livejournal.com/49333.html&lt;/a&gt; for the list.&lt;br /&gt;&lt;br /&gt;If you&apos;re interested in learning it, I&apos;ve posted some advice on resources at &lt;a href=&quot;http://pozorvlak.livejournal.com/58387.html&quot;&gt;http://pozorvlak.livejournal.com/58387.html&lt;/a&gt; . I&apos;d also be happy to answer any questions. But since you&apos;re in London, you should seriously consider subscribing to the London Perl Mongers mailing list (london.pm.org), or going along to some of their meetings - there are some awesomely good programmers in that group, and they&apos;re a pretty friendly bunch. London.pm tech meetings are a great way of opening your eyes to how much is possible.&lt;br /&gt;&lt;br /&gt;[Note: I specify London.pm mainly because I used to be a member and can personally vouch for their excellence. Your &lt;a href=&quot;http://www.pm.org/&quot;&gt;local Perl M[ou]ngers group&lt;/a&gt; may well be just as good, and is certainly worth looking at.]&lt;br /&gt;&lt;br /&gt;Some of the stories in  &lt;a href=&quot;http://www.perl.com/pub/a/2007/12/21/20-years-of-perl.html&quot;&gt;Memories of 20 years of Perl&lt;/a&gt; may also help convince you to take a look. I especially like the story in the second comment. Larry Wall&apos;s speech &lt;a href=&quot;http://www.wall.org/~larry/pm.html&quot;&gt;Perl, the first postmodern computer language&lt;/a&gt; is also compulsory reading.&lt;br /&gt;&lt;br /&gt;I hope that helps!</description>
  <comments>http://pozorvlak.livejournal.com/101155.html</comments>
  <category>computers</category>
  <category>programming</category>
  <category>beware the geek</category>
  <category>perl</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/101041.html</guid>
  <pubDate>Fri, 25 Apr 2008 23:49:07 GMT</pubDate>
  <title>Argmungers in universal algebra</title>
  <link>http://pozorvlak.livejournal.com/101041.html</link>
  <description>Some of you might be interested to learn that &lt;a href=&quot;http://pozorvlak.livejournal.com/95275.html&quot;&gt;argmungers&lt;/a&gt; are now explicitly included in my thesis: the mathematical concept, that is, not the code. One can recast classical universal algebra (which works syntactically, with words in a recursive language and denumerable sets of variables) in terms of &lt;a href=&quot;http://pozorvlak.livejournal.com/67276.html&quot;&gt;planar trees of operators&lt;/a&gt; (abstract syntax trees, effectively) acted on by munging functions (and yes, I use the term &quot;munging function&quot;). Restricting the munging functions allowed is equivalent to imposing syntactic restrictions on the equations defining your theories: I&apos;m writing up a proof of this at the moment. Interestingly, isolating the concept of munging functions makes the whole thing significantly cleaner: up until then, the theorem was frustratingly obvious, but trying to prove it (or even state it!) rigorously was like nailing jelly to the wall.&lt;br /&gt;&lt;br /&gt;Maybe I should thank Hitesh in my acknowledgements...&lt;br /&gt;&lt;br /&gt;Oh, and current state of play:&lt;pre&gt;Sat Apr 26 00:47:12 BST 2008
4511 lines 22164 words 155551 characters
thesis.log:Output written on thesis.dvi (78 pages, 626444 bytes).
34 fixmes&lt;/pre&gt; I was up to 79 pages, but then I deleted some redundant stuff, so now I&apos;m back down to 78.&lt;br /&gt;&lt;br /&gt;Right, time to pack for the mountains tomorrow.</description>
  <comments>http://pozorvlak.livejournal.com/101041.html</comments>
  <category>thesis</category>
  <category>maths</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/100611.html</guid>
  <pubDate>Fri, 25 Apr 2008 13:00:43 GMT</pubDate>
  <title>Attention, readers!</title>
  <link>http://pozorvlak.livejournal.com/100611.html</link>
  <description>You have lost &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Game_%28mind_game%29&quot;&gt;The Game&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;That is all.&lt;br /&gt;&lt;br /&gt;&lt;small&gt;&lt;span class=&apos;ljuser&apos; lj:user=&apos;mi_guida&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://mi-guida.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://mi-guida.livejournal.com/&apos;&gt;&lt;b&gt;mi_guida&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;: I have won the Pillaging Game.&lt;/small&gt;</description>
  <comments>http://pozorvlak.livejournal.com/100611.html</comments>
  <category>games</category>
  <category>memes</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/100420.html</guid>
  <pubDate>Mon, 21 Apr 2008 10:00:56 GMT</pubDate>
  <title>The White Spider</title>
  <link>http://pozorvlak.livejournal.com/100420.html</link>
  <description>I&apos;ve just started reading &lt;a href=&quot;http://en.wikipedia.org/wiki/The_White_Spider&quot;&gt;The White Spider&lt;/a&gt;, Heinrich Harrer&apos;s account of his 1938 first ascent of the fearsome &lt;a href=&quot;http://en.wikipedia.org/wiki/Eiger&quot;&gt;North Face of the Eiger&lt;/a&gt;. The climb was one of the pivotal moments in the history of mountaineering, and the book&apos;s considered one of the classics of mountain literature. I was particularly struck by the opening paragraphs:&lt;blockquote&gt;&quot;Writing a book about the North Face of the Eiger? Whatever for?&quot;&lt;br /&gt;The question was put to me by a man of some standing in Alpine circles. I was taken aback and slightly cross, so I gave him a somewhat off-hand answer: &quot;For people to read, of course.&quot;&lt;br /&gt;    That started him off on a passionate tirade.&lt;br /&gt;&quot;Who&apos;s likely to read it? Don&apos;t you think the handful of climbers who are really interested in that crazy venture have had quite enough literature on the subject already? Or do you just want to join the sensation-mongers, from whose ranks a serious climber like yourself should keep as remote as possible?&quot;&lt;br /&gt;I answered him: &quot;If all climbers shared your point of view, it wouldn&apos;t be surprising to find the newspaper reports overflowing with mis-statements and exaggerations. I believe the public has a right to authoritative information, especially when mountaineering problems become human ones. And I think it is a climber&apos;s duty to contribute to the formation of public opinion in such matters.&quot;&lt;br /&gt;And with that I dropped the unpleasant argument.&lt;/blockquote&gt; It struck me as I read those words that one could replace &quot;climbing&quot; with &quot;mathematics&quot;, &quot;the Eiger&quot; with the name of some serious mathematical problem, etc., and be left with a statement that&apos;s equally true, and equally important.&lt;br /&gt;&lt;br /&gt;[By the way, there are some excellent, not to mention terrifyingly vertiginous, pictures of Sir Ranulph Fiennes on the Eiger&apos;s North Face &lt;a href=&quot;http://www.ukclimbing.com/articles/page.php?id=768&quot;&gt;here&lt;/a&gt;. Well worth a look.]</description>
  <comments>http://pozorvlak.livejournal.com/100420.html</comments>
  <category>books</category>
  <category>mountains</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/99892.html</guid>
  <pubDate>Tue, 15 Apr 2008 15:05:19 GMT</pubDate>
  <title>Public Service Announcement</title>
  <link>http://pozorvlak.livejournal.com/99892.html</link>
  <description>I say this every year, but judging by my friends page and the state of my flatmates, it bears repeating.&lt;br /&gt;&lt;br /&gt;Many of you are, or shortly will be, undergoing examinations - mostly Finals, a scattering of other things. To a man, woman, or small furry creature from Alpha Centauri, you all seem to be panicking, convinced that you haven&apos;t done any work, that you don&apos;t know anything, and that your only hope of redeeming your tattered academic credibility is to throw yourself into a routine of work so intense that your vocal cords atrophy from lack of use, your pen-holding fingers swell to the size of your arms, and your skin shrivels on contact with sunlight.&lt;br /&gt;&lt;br /&gt;This is &lt;i&gt;exactly wrong&lt;/i&gt;. First off, if you&apos;re reading this you&apos;re probably a friend of mine, and hence considerably smarter than the average bear: you have nothing to worry about. Secondly, mere lack of knowledge is not the problem. Mere lack of knowledge is generally a &lt;i&gt;trivial&lt;/i&gt; problem. The real problem is &lt;i&gt;Finals stress&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Allow me to expand on that. If you remain calm, keep alert, and generally keep your mind in a state where you can &lt;i&gt;think&lt;/i&gt; as opposed to panicking, then your raw talent, coupled with the knowledge you currently have (a lot more than you realise, provided you haven&apos;t, say, been doing ten plays a term for the last three years), will get you a lot further than you now realise. Maybe not enough to get you as good a degree as you&apos;d like, but enough to stop you embarrassing yourself. In addition, your mind will be better able to absorb more information, and you&apos;ll be more able to actually do some work. If, however, you allow yourself to be whipped up into a fervour of panic, then you will lose the all-important ability to &lt;i&gt;think&lt;/i&gt;, and you will be lost. Worse than that: the panic will prevent you from getting any useful work done, and you won&apos;t take anything in.&lt;br /&gt;&lt;br /&gt;So, your priorities should be:&lt;ul&gt;&lt;li&gt;Don&apos;t stress about how little work you&apos;re doing. That&apos;s not important, and stressing about it is actively unhelpful.&lt;/li&gt;&lt;li&gt;Do make sure you&apos;re sleeping, eating and exercising properly. Get out in the sun. Make sure you see your friends. Chill out. Relax.&lt;/li&gt;&lt;li&gt;Don&apos;t stress about your failure to achieve these goals, either. Get it right tomorrow. Repeat as necessary.&lt;/li&gt;&lt;/ul&gt; Get these right, and success will follow.</description>
  <comments>http://pozorvlak.livejournal.com/99892.html</comments>
  <category>doomed</category>
  <category>universities</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/99735.html</guid>
  <pubDate>Wed, 09 Apr 2008 09:58:44 GMT</pubDate>
  <title>Diet update</title>
  <link>http://pozorvlak.livejournal.com/99735.html</link>
  <description>&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;This morning, I weighed 10st 3.2lb. That&apos;s 143.2lb for the USians, and 65kg in SI; either way, it means the following:&lt;ol&gt;&lt;li&gt;I am now the same weight as I was when I was sixteen and training 12-15 hours per week. Admittedly, I was more muscular then.&lt;/li&gt;&lt;li&gt;I have lost two stone (28lb/13kg) since starting the &lt;a href=&quot;http://pozorvlak.livejournal.com/tag/diet&quot;&gt;diet&lt;/a&gt; last July.&lt;/li&gt;&lt;li&gt;I have finally achieved my target weight, and can relax the calorie restrictions to &quot;maintenance&quot; levels.&lt;/li&gt;&lt;/ol&gt;So, success! It took a lot longer than expected, after a promising early start: I was down to 11 stone by the time we went hillwalking in Wales at the end of August, got down to 10st 5ish by the beginning of December, then the Christmas party season kicked in and it got a bit hard. I was 10st 10 after Christmas: it should only have taken a couple of months to lose the excess, but it turns out that it&apos;s really hard to convince yourself not to have that pint/sandwich/biscuit when you&apos;re hungry and/or wanting a drink and you&apos;re only a couple of pounds over.&lt;br /&gt;&lt;br /&gt;Actually, it feels rather like cheating: I was 10st 6.4 on Monday, then apparently lost nearly 4lb in one day and became 10st 2.8 on Tuesday. I was treating this as a suspicious fluke, but today&apos;s measurement seems to confirm that there&apos;s something in it. Still, I shan&apos;t be too surprised if I&apos;m 10st 5 again tomorrow. In general, my weight fluctuates by a pound or two from day to day.&lt;br /&gt;&lt;br /&gt;Some things I&apos;ve learned, in no particular order:&lt;ul&gt;&lt;li&gt;For me at least, calorie-counting really works. Basically, I&apos;ve lost weight when I&apos;ve been bothering to do the calorie-counting, and not when I haven&apos;t. I suppose there&apos;s an interesting question here: does calorie-counting work because it constrains you into only eating &quot;healthy&quot; things, or do &quot;healthy thing&quot; diets work because they reduce your calorie intake by stealth? It&apos;s not so easy to test, because so much of dieting is about psychology. That said, the physics is clear: calorie-counting will inevitably work if you can stick to it.&lt;/li&gt;&lt;li&gt;It&apos;s amazing how emotional people get about other people&apos;s diets. If I&apos;ve learned anything from this, it&apos;s to ignore the opinions of others and stick to my guns.&lt;/li&gt;&lt;li&gt;For me, giving up alcohol is an unfortunate prerequisite to losing weight. As well as being calorific itself, alcohol makes it so much more tempting to eat and drink more.&lt;/li&gt;&lt;li&gt;I&apos;ve had some serious advantages on this diet: chiefly, I&apos;ve had a time in my recent past when I was fit and slim, and wanting to feel like that again has been a powerful motivator. I&apos;m also male and do some exercise (both of which increase calories burned: more total calories burned give you more of a safety margin on any given day). I&apos;m reasonably numerate, and I&apos;m happy with making approximations - I never used to write anything down, just round everything I ate to the nearest fifty calories and added it up in my head as I went along. I drink coffee, and a hot drink is a wonderful distraction when you feel like eating something but you&apos;re not really hungry (or even when you are). I don&apos;t eat a lot of sweets. In general, my diet wasn&apos;t particularly bad before, but the occasional trip to the chip shop or the pub (or rather, the pub and then the chip shop) and the cheese-on-bagel snacks all added up over the course of years. Which is not to say that it&apos;s been easy: I like food and drink, and I like eating and drinking. I also strongly connect the idea of &quot;having a good time&quot; to the idea of &quot;eating and drinking a lot&quot; - I probably need to break that connection somehow.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;All praise be unto &lt;a href=&quot;http://www.fourmilab.ch/hackdiet/www/hackdiet.html&quot;&gt;The Hacker&apos;s Diet&lt;/a&gt;.</description>
  <comments>http://pozorvlak.livejournal.com/99735.html</comments>
  <category>diet</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/99075.html</guid>
  <pubDate>Sun, 30 Mar 2008 19:44:57 GMT</pubDate>
  <title>Pozorvlak&apos;s Conjectures</title>
  <link>http://pozorvlak.livejournal.com/99075.html</link>
  <description>For the past couple of years (longer, actually), I&apos;ve been &lt;a href=&quot;http://pozorvlak.livejournal.com/tag/type+systems&quot;&gt;thinking a lot&lt;/a&gt; about this business of static and dynamic typing in programming languages. Here&apos;s my current position on the matter.&lt;br /&gt;&lt;br /&gt;Static and dynamic typing encourage and reward quite remarkably different approaches to the creation of software: everything from the nitty-gritty, (sit and think?)-edit-(compile?)-run-(test?)-(debug?)-(repeat?) cycle to the design (at all levels) of the software to be created, taking in every aspect of the tools and process used to support this design and implementation. Also, the choice of static or dynamic typing is best understood as part of a larger attitude towards development. Unfortunately, the use of a dynamic mindset with a static language not only means that you can&apos;t take advantage of the tools available (or even see why they&apos;d be useful), it actively hinders success. The same is true for approaching a dynamic language with a static mindset.&lt;br /&gt;&lt;br /&gt;I would therefore like to propose &lt;b&gt;Pozorvlak&apos;s Conjectures&lt;/b&gt;:&lt;ol&gt;&lt;li&gt;If you find that a modern dynamic type system causes more problems than it solves, you&apos;re probably doing it wrong.&lt;/li&gt;&lt;li&gt;If you find that a modern static type system causes more problems than it solves, you&apos;re probably doing it wrong.&lt;/li&gt;&lt;/ol&gt; For instance, I find Haskell&apos;s type system causes me many more problems than it solves. Discussions with more expert Haskell users suggest that I am indeed doing it wrong. &lt;a href=&quot;http://reddit.com/info/6dkxn/comments/c03k62y&quot;&gt;This guy&lt;/a&gt;, on the other hand, finds that &quot;the dynamic languages stick out like sore thumbs because of the whole class of dynamic run time errors that show up that don&apos;t even appear in the statically typed languages&quot;. If you find this, I claim that it&apos;s because &lt;i&gt;your code is not polymorphic enough&lt;/i&gt;&lt;small&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/small&gt;. You can get away with having code which only accepts data of very restricted types when the compiler does all the checks for you statically. When it doesn&apos;t, you&apos;re better off writing code that behaves well for a wider class of inputs, and dynamic languages give you much more facility to do this. Once you learn to code like this, your problems largely go away. As a bonus, your code becomes more flexible, and whole classes of techniques become possible that would have been literally unthinkable before. Similar claims, it appears, can be made for static languages: at the higher levels of mastery, one can use a static type system as a theorem-prover to establish some quite nontrivial properties of your program automatically and across the entire codebase. This allows for some excitingly different approaches to program development.&lt;br /&gt;&lt;br /&gt;A corollary is that if you ever finding yourself saying that your port of Feature X to Language Y is better than the original Feature X solely because it&apos;s (statically|dynamically) typed and the original Feature X was the other one, you should probably save your breath. It will probably also be worth your while to go back and determine what advantages the opposite choice of typing regimen gave to Feature X&apos;s users.&lt;br /&gt;&lt;br /&gt;&lt;small&gt;&lt;sup&gt;1&lt;/sup&gt; A less interesting, but probably valid conjecture is that you&apos;re also &lt;i&gt;not testing enough&lt;/i&gt;, or at least testing the wrong things. But this can&apos;t be the only answer. Dynamic programmers, in general, are not idiots; they are usually also Lazy, in the good sense. They&apos;re smart enough to work out that writing the equivalent &lt;code&gt;isa_ok()&lt;/code&gt; test every time they would have written a type declaration in Java or whatever is no time-saver at all. Hence, they must need &lt;i&gt;less type information&lt;/i&gt; overall for their code to be correct.&lt;/small&gt;</description>
  <comments>http://pozorvlak.livejournal.com/99075.html</comments>
  <category>computers</category>
  <category>programming</category>
  <category>type systems</category>
  <category>beware the geek</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/98580.html</guid>
  <pubDate>Fri, 28 Mar 2008 15:40:55 GMT</pubDate>
  <title>Better living through shell scripting</title>
  <link>http://pozorvlak.livejournal.com/98580.html</link>
  <description>As I may have mentioned once or twice before, I&apos;m writing up my thesis. This is an intensely slow and depressing process, and the temptation to slack off is overwhelming. Being a geek, I decided to write some code to help me. Writing code rather than writing thesis is still slacking off, obviously, but it&apos;s slacking off to a useful end. Writing blog posts about writing code that&apos;s meant to help me write my thesis is another matter...&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;I started with a simple script to make it as easy as possible to start work. &lt;blockquote&gt;&lt;pre&gt;#!/bin/sh

cd ~/tex/thesis
evince thesis.dvi &amp;
vi categorification.tex&lt;/pre&gt;&lt;/blockquote&gt;That opens the directory containing my thesis, opens a viewer for the printer-ready version, and opens a text editor on one of the files containing source code. I stuck this in &lt;code&gt;~/bin/thesis&lt;/code&gt;, made it executable, then created a button on my Gnome toolbar to launch an xterm and run this file. This worked, to some extent, but there was still a problem: I could click the button, then open a browser and spend ages on Reddit or Livejournal before glancing at the clock and discovering to my horror that it was an hour later and I hadn&apos;t done any work. More drastic measures were needed. Version 2:&lt;blockquote&gt;&lt;pre&gt;#!/bin/sh

cd ~/tex/thesis
evince thesis.dvi &amp;
disallow firefox-bin gnobots2 ssh &amp;
vi categorification.tex&lt;/pre&gt;&lt;/blockquote&gt;&lt;code&gt;disallow&lt;/code&gt; is a tiny script I wrote for just this purpose, which runs in the background and prevents you from running particular programs (here, Firefox, ssh (which I use for email) and the highly addictive Gnobots game). There&apos;s probably a standard way of doing this, but I don&apos;t know what it is, and it was trivial to write the script: &lt;blockquote&gt;&lt;pre&gt;#!/bin/sh

while true
do
        killall $@ 2&amp;gt; /dev/null
        sleep 6
done&lt;/pre&gt;&lt;/blockquote&gt; Talk about high-level programming: that practically is its specification. Loop continually, kill all the programs specified as command-line arguments, throwing away any error messages, go to sleep for six seconds, then do it again. The reason it&apos;s six seconds is because originally I had 60 seconds, deleted the 0 to make the testing cycle quicker, then thought &quot;Actually, that&apos;s not such a bad idea...&quot; &lt;br /&gt;&lt;br /&gt;This sort of trivial scripting is pretty much the reason I use Unix in a nutshell. Unix has this deep hackability to it: writing your own utilities to do this kind of thing is so easy compared to most other systems.&lt;br /&gt;&lt;br /&gt;Of course, &lt;code&gt;disallow&lt;/code&gt; is an attempt to solve a social problem (my reluctance to do any work) by technological means, and comes with all the usual caveats. Two days in, it doesn&apos;t appear to be especially successful, but maybe it will have a more gradual effect.&lt;br /&gt;&lt;br /&gt;The next script gathers data about the thesis, and tells me how long it is and how many incomplete sections there are.&lt;blockquote&gt;&lt;pre&gt;#!/bin/sh

wc *.tex | grep total | total -l &apos;lines words characters&apos;
grep pages *.log
grep -c XXX *.tex | total -l fixmes
&lt;/pre&gt;&lt;/blockquote&gt;The thesis is contained in a load of TeX files (with the extension .tex) which are compiled into an output file called thesis.dvi. The standard Unix utility &lt;code&gt;wc&lt;/code&gt; can be used to find the number of lines, words and characters in all the .tex files - its notion of a &quot;word&quot; includes TeX formatting commands, but the idea of counting the words in a piece of mathematics is pretty wooly anyway. If you ask &lt;code&gt;wc&lt;/code&gt; to count words in lots of files at once, it outputs a nice line at the bottom with the totals for all files: the &lt;code&gt;grep total&lt;/code&gt; picks out this line and throws away the rest. The file thesis.log contains chatter from the compilation step, and in particular it contains a line saying how many pages were in the output. Incomplete sections are indicated by an &quot;XXX&quot; in the TeX file next to the relevant bit, because I can&apos;t be arsed to set up an actual bug database, and one would be overkill anyway.&lt;br /&gt;&lt;br /&gt;The interesting parts of this script are the calls to the program &lt;code&gt;total&lt;/code&gt;, which is also homebrewed. It&apos;s a program I&apos;ve found myself needing a few times before, and of course it turned out to be quicker to write it than to work around its absence. Here&apos;s its code:&lt;blockquote&gt;&lt;pre&gt;#!/usr/bin/perl
use Getopt::Std;

getopt(&apos;l&apos;);
my @totals;
while (&amp;lt;&amp;gt;) {
        my @newnums = /(\d+)/g;
        foreach (0 .. $#newnums) {
                $totals[$_] += $newnums[$_];
        }
}
my @labels = split /\s+/, $opt_l;
foreach (0 .. $#labels) {
        if (!defined($totals[$_])) { $totals[$_] = 0 }
        $totals[$_] .= &quot; $labels[$_]&quot;;
}
print join(&quot; &quot;, @totals).&quot;\n&quot;;&lt;/pre&gt;&lt;/blockquote&gt; This code (of which I am in no way proud) takes each line in its input (in a &lt;code&gt;grep&lt;/code&gt;y, &quot;files specified on the command line or stdin if there are none&quot;, way), looks for numbers (specifically, positive integers), then adds them together columnwise. It then displays the totals, possibly with labels (specified using the -l option). It has many weaknesses: most egregiously, it only looks for positive integers (which would be easily fixable by using the CPAN module Regex::Common). It takes the contents of &quot;column&quot; &lt;i&gt;n&lt;/i&gt; to be the &lt;i&gt;n&lt;/i&gt;th number encountered on each line, so it can also get confused by missing data in early columns, or (as happened during testing) things like filenames with numbers in. This bug was closed by inspecting the relevant files, discovering that I didn&apos;t need them, and deleting them :-) But for now, &lt;i&gt;total&lt;/i&gt; does what I need. And it paid off almost immediately: having written it, I realised that I could use it to label the output of &lt;code&gt;wc&lt;/code&gt; to make it friendlier (though perhaps this functionality should be spun off into another&lt;br /&gt;program, perhaps called &lt;code&gt;label&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;Here&apos;s the output of &lt;code&gt;metrics&lt;/code&gt;:&lt;blockquote&gt;&lt;pre&gt;5230 lines 24528 words 174762 characters
thesis.log:Output written on thesis.dvi (70 pages, 555828 bytes).
44 fixmes&lt;/pre&gt;&lt;/blockquote&gt; Hurrah! As a bonus, I can now use this script on any directory containing TeX source :-)&lt;br /&gt;&lt;br /&gt;[If you know the names of any of the standard Unix utilities I&apos;ve undoubtedly reinvented, please let me know.]</description>
  <comments>http://pozorvlak.livejournal.com/98580.html</comments>
  <category>computers</category>
  <category>thesis</category>
  <category>programming</category>
  <category>unix</category>
  <category>beware the geek</category>
  <category>perl</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/98440.html</guid>
  <pubDate>Tue, 25 Mar 2008 00:15:14 GMT</pubDate>
  <title>Beinn Dubhcraig - photos</title>
  <link>http://pozorvlak.livejournal.com/98440.html</link>
  <description>I&apos;ve posted some &lt;a href=&quot;http://moblog.co.uk/view.php?id=317416&quot;&gt;photos of the Beinn Dubhcraig trip&lt;/a&gt; to my moblog. Larger versions exist, and I&apos;ll try to find a home for them: my Flickr account has sat unused for so long (prior to the Yahoo buyout) that it&apos;s not letting me log in any more :-(</description>
  <comments>http://pozorvlak.livejournal.com/98440.html</comments>
  <category>mountains</category>
  <category>links</category>
  <category>munros</category>
  <category>photography</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/98058.html</guid>
  <pubDate>Mon, 24 Mar 2008 20:34:27 GMT</pubDate>
  <title>Mountaineering experience</title>
  <link>http://pozorvlak.livejournal.com/98058.html</link>
  <description>&lt;blockquote&gt;&quot;What you need is combat experience. That&apos;s what keeps you alive in real combat.&quot;&lt;br /&gt;&quot;OK, but how can you tell the difference between combat experience and real combat?&quot;&lt;br /&gt;&quot;Simple. If you&apos;re alive at the end, it was combat experience.&quot;&lt;br /&gt;(From &lt;a href=&quot;http://en.wikipedia.org/wiki/Halo_Jones&quot;&gt;The Ballad of Halo Jones&lt;/a&gt;)&lt;/blockquote&gt;&lt;br /&gt;Saturday&apos;s trip to the hills started inauspiciously: I slept through all my alarms, and was only woken up by Jo texting to say &quot;I&apos;m parked outside&quot;. My bag was packed, but there was still a forty-minute interval of running around before I was showered, breakfasted, infused with tea, dressed and ready to go. Then we were off, at the decidedly late starting time of 9am.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;h3&gt;Beauty&lt;/h3&gt;We&apos;d planned to climb &lt;a href=&quot;http://maps.google.co.uk/maps/mm?ie=UTF8&amp;amp;hl=en&amp;amp;ll=56.396805,-4.780769&amp;amp;spn=0.121415,0.32135&amp;amp;t=p&amp;amp;z=12&quot;&gt;Beinn Dubhcraig&lt;/a&gt;, the easternmost of a group of four hills south-west of Tyndrum (the others being, from east to west, Ben Oss, Ben Lui, and Beinn a Chleibh). It&apos;s one of the most beautiful parts of the Highlands, but I&apos;ve had a lot of bad luck there. Philipp and I once tried to do all four in a day, which resulted in us missing out two and having to run the last 7km to the station in an hour to avoid missing the last train - which doesn&apos;t sound like a lot, but you try doing it in hiking boots after you&apos;ve been walking through foot-deep snow for eight hours. As for Beinn Dubhcraig, I&apos;ve had maybe five really miserable days&apos; walking in the last three years, and my first trip to Beinn Dubhcraig a few years ago was one of them - herringboning up steep slopes with hail battering into our eyes for hours on end, freezing cold and with soaking, freezing hands. We&apos;d taken a grid reference for the summit at the bottom, but six-figure grid refs only specify an area the size of a football pitch, so we then had to spend three quarters of an hour wandering around the summit plain taking altitude readings until we found what appeared to be the summit - the visibility was far too bad for us to look from one high point to the other and compare.&lt;br /&gt;&lt;br /&gt;Yesterday, however, the conditions were looking much better. The sun was out, and the forecast predicted an 80% chance of cloud-free tops and a mere -23C after wind chill - positively balmy after recent weeks. A quick hand stuck out the window suggested that I should probably wear the warm lined trousers anyway :-) It was Jo&apos;s first hillwalk in the winter, but I reassured her that on a day like today it really shouldn&apos;t be too big a deal, and that the mountains look stunning with snow on them. I packed the ice axe and the crampons anyway. Only one set of each, unfortunately, but since I was the only one with crampon-compatible boots, I thought I&apos;d give her the axe and take the crampons for myself in the unlikely event that we needed them.&lt;br /&gt;&lt;br /&gt;We got to the car-park at about 10.30, which is about the time we would have arrived if we&apos;d got up much earlier and caught the train, so that was OK. We were presented with a choice of route - either we could go left, up a big winding path through the forest and eventually end up on the north-east ridge, or we could go right, cut across the flat land in front of the corrie and join the ridge from the right. We elected to do the latter, but this was probably the wrong choice: there was a small river between us and the mountain, and we&apos;d forgotten that river crossings have an unfortunate tendency to take bloody ages. I got across some stepping stones fairly quickly, but the gap between two of them was too wide for Jo, so we wasted a good three-quarters of an hour walking up the river on opposite sides, trying to find a crossing that she was prepared to use. Eventually she just waded across a shallow part, getting her boots and socks wet. By this time, we were quite a bit off our planned route - in fact, we probably would have been quicker sticking to the path and going on for another kilometre or so to the bridge.&lt;br /&gt;&lt;br /&gt;We were now pretty much equidistant between the north-east and north-west ridges, so we decided to change plans and head up the north-west ridge, which would afford better views of the rest of the range. We stopped for lunch in some trees at about 12.30, and it was at about this point that we saw the Easter Bunny (or rather, a hare still in its winter coat - though apparently the Easter Bunny &lt;a href=&quot;http://en.wikipedia.org/wiki/Easter_Bunny&quot;&gt;was originally a hare, not a rabbit...&lt;/a&gt;). As we gained the ridge, more and more mountains came into view, and finally Ben Lui rose up above the ridge, looking as beautiful as I&apos;d ever seen it. &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/John_Peel_%28farmer%29&quot;&gt;From a find to a check, from a check to a view, from a view to a kill in the morning&lt;/a&gt;&quot;, I recited to myself.&lt;br /&gt;&lt;br /&gt;It was at about this point that we reached the snowline, and took the opportunity to practice &lt;a href=&quot;http://en.wikipedia.org/wiki/Self-arrest&quot;&gt;ice-axe arrests&lt;/a&gt; on a handy slope. The snow wasn&apos;t as good as I&apos;d hoped - though there were patches of fresh powder, it was mostly old snow that had partially melted and re-frozen to form what skiers call &quot;crud&quot; (&lt;b&gt;edit&lt;/b&gt;: and mountaineers call &quot;n&amp;eacute;v&amp;eacute;&quot;), making for a very slippery surface. As planned, I put my crampons on, and gave the axe to Jo, with a quick demo of how to use it to walk on snow slopes (hold it in the uphill hand, adze forward so it&apos;s in the right position for a self-arrest, and plant the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ice_axe&quot;&gt;spike&lt;/a&gt; in the snow  to hold a slip while you step). The snow was patchier than I&apos;d have liked, and I had to take my crampons off a couple of times as we went over grass again, but we were on the summit by just before three, to be greeted by one of the most gorgeous views I&apos;ve ever seen. No difficulty finding the summit now - we could see all the way to the Paps of Jura. Loch Lomond and its surrounding hills, the mountains at Bridge of Orchy, the sites of any number of previous days out were visible to us. Absolutely stunning. We took a lot of pictures, but there wasn&apos;t a lot of time to hang about - the wind was starting to pick up, and, at nearly a thousand metres above sea level and exposed on all sides, it was getting chilly. Jo had wrung her socks out a few times, but her feet were still wet, and hence cold. We set off down the north-east ridge, partly because it was the more direct route to the car park, but mostly because it was the one we hadn&apos;t done.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid2&quot;&gt;&lt;/a&gt;&lt;h3&gt;Drama&lt;/h3&gt;Unfortunately, it wasn&apos;t as straightforward as the other one had been. About half an hour later, we encountered a big steep dip that we couldn&apos;t see over. Can&apos;t go under it, can&apos;t go over it, have to go round it. So we headed off to the right, hoping to circumnavigate it. Still a bit steep, but better - we could see the way ahead, at least. Shortly afterwards, we came to a snow slope, maybe fifty metres long.&lt;br /&gt;&lt;br /&gt;&quot;Slide down on our bums?&quot; suggested Jo.&lt;br /&gt;&lt;br /&gt;Sliding down snow slopes on your bum is technically known as &quot;glissading&quot;, and if you look up &quot;glissade&quot; in the Mountain Leadership handbook&apos;s index you&apos;ll be presented with the pity advice &quot;Don&apos;t&quot;. However, it has its upsides: most of all, it&apos;s a lot quicker than trudging down painstakingly (which carries its own dangers). &quot;Hang on a bit, I just need to zip up my pockets so my railcard doesn&apos;t fall out,&quot; I assented.&lt;br /&gt;&lt;br /&gt;Jo sat down and set off, and immediately I saw something was wrong. There&apos;s a standard technique for using the pick of your ice axe to control the speed and direction of your descent during a glissade, but I realised too late that I hadn&apos;t taught it to her, and she was Doing It Wrong, trying to use the spike as a rudder instead. That put her off-balance from the start, but the cruddy snow was her real undoing - the slippery, refrozen surface sped her up rather than slowing her down, and within moments she was hurtling down the slope, flailing wildly and totally out of control.&lt;br /&gt;&lt;br /&gt;Shit, shit shit. Self-arrest, Jo, self-arrest...&lt;br /&gt;&lt;br /&gt;The axe flew out of her hands as she spun around and she hurtled on without it. Now she wouldn&apos;t be able to use it to stop herself. Why wasn&apos;t it leashed to her wrist? But then, thank God, she hit a shallower part of the slope, and after another heartstopping second or two she came to a crumpled halt at the bottom of the slope.&lt;br /&gt;&lt;br /&gt;I was at the top of the slope, she was all the way down at the bottom, and probably injured. I had to get down as quickly as possible to render aid. Nothing for it but to glissade myself. But the axe was a good forty metres below me, so I&apos;d have to control my speed with my hands and feet. Not good.&lt;br /&gt;&lt;br /&gt;I sat down, braced myself, and started to slide down. By scraping my boot edges along the snow (I&apos;d taken my crampons off) I was able to control my speed and come down the slope under reasonable control. I veered slightly to the left to pick up the axe.&lt;br /&gt;&lt;br /&gt;Red dots in the snow. Blood. She&apos;s bleeding. Fuck.&lt;br /&gt;&lt;br /&gt;Get down to where Jo is. Her face is covered with blood, but she&apos;s moving. She&apos;s still got her glasses - that&apos;s a good thing.&lt;br /&gt;&lt;br /&gt;&quot;OK, let&apos;s have a look at you.&quot;&lt;br /&gt;*peers*&lt;br /&gt;&quot;You&apos;ve got a nasty cut in your eyebrow. Let&apos;s get the blood cleaned off and see how bad it is.&quot;&lt;br /&gt;&quot;There&apos;s a first aid kit in my bag.&quot;&lt;br /&gt;&quot;Which section?&quot;&lt;br /&gt;&quot;The main one.&quot;&lt;br /&gt;&quot;Main section?&quot;&lt;br /&gt;&quot;Yeah.&quot;&lt;br /&gt;&lt;br /&gt;Rummage through bag, find first aid kit. Open it. Not much there.&lt;br /&gt;&lt;br /&gt;&quot;OK, I&apos;ve got a wet-wipe, let&apos;s wipe the blood off and see what&apos;s wrong. Do you know what happened?&quot;&lt;br /&gt;&quot;I think I must have hit my head on the shaft of the ice axe.&quot;&lt;br /&gt;&quot;Well, thank God it wasn&apos;t any of the sharp bits.&quot;&lt;br /&gt;&lt;br /&gt;Take out wet-wipes. Fumble with them, drop them, watch them speed away down the slope. Bollocks. Kick shelf in snow for first aid kit. Take out antiseptic wipe, fumble, drop, watch it speed away. I&apos;ve only got my thin inner gloves on, and my fingers are getting pretty painful. Successfully extract wipe from container, hand to Jo to wipe off relevant area. Take closer look at cut.&lt;br /&gt;&lt;br /&gt;&quot;I think we&apos;re going to have to go to A&amp;E, I might need stitches.&quot;&lt;br /&gt;&quot;Yeah, possibly, it looks fairly deep. It&apos;s hard to tell though, it keeps welling blood.&quot;&lt;br /&gt;&quot;We&apos;d better apply pressure to it.&quot;&lt;br /&gt;&quot;Yep. Hang on.&quot;&lt;br /&gt;&lt;br /&gt;Fumble through first aid kit. Find dressing, extract from packet, hand to Jo. A bit thin, and nothing to hold it in place, but it&apos;ll do for a start.&lt;br /&gt;&lt;br /&gt;&quot;OK, hold this to the wound.&quot;&lt;br /&gt;&quot;Where exactly do I need to hold it?&quot;&lt;br /&gt;&quot;Just... here. I can&apos;t see anything to hold it in place in here: I&apos;ll get out my first aid kit and have a look in that.&quot;&lt;br /&gt;&lt;br /&gt;Take off rucksack, pin in place with axe, furkle through to bottom of bag to get first aid kit.&lt;br /&gt;&lt;br /&gt;&quot;OK, we&apos;ve got some micropore tape and... aha, here&apos;s a dressing with a bandage.&quot;&lt;br /&gt;&lt;br /&gt;Apply second dressing over first one, tie bandage underneath ponytail so it holds in place.&lt;br /&gt;&lt;br /&gt;&quot;Can you see?&quot;&lt;br /&gt;&quot;Wait a second.&quot;&lt;br /&gt;&lt;br /&gt;Jo shifted the dressing around, so she could see out of her right eye.&lt;br /&gt;&lt;br /&gt;&quot;Only out of my right eye&quot;.&lt;br /&gt;&quot;OK, we can have another look at it when we&apos;re on the flat.&quot;&lt;br /&gt;&quot;Shit! Look!&quot;&lt;br /&gt;&lt;br /&gt;I turned around, to see that a plastic bag had fallen out of Jo&apos;s rucksack and was sliding down the slope, picking up speed. It looked like it had her wallet in it and - shit, what if it had the car keys? I hurried down after it, trying not to slip and become a casualty myself. OK, wallet - grab, mobile phone - try to stop with boot edge, but there&apos;s a reason I never got picked for the football team at school... stomp down again, get it this time. Pick up phone, bag starting to slow, snatch at it. No sign of the car keys: they must have been in another bag. A couple of Alpen bars have fallen out of the bag and are making a separate break for freedom - what the hell, I&apos;ve come this far down, and they&apos;re not moving too fast. Oh, great, they&apos;ve stopped. OK, carefully pick them up and put them in the bag - ah, there&apos;s the missing antiseptic wipe. No sign of the wet-wipes, though. Pity, we could have used them to clean the dried blood off. Put recovered items in bag, trudge back up slope to Jo.&lt;br /&gt;&lt;br /&gt;Jo was understandably shaken by the whole thing, but OK to walk. Her legs were shaking a bit, though, which wasn&apos;t ideal on the terrain. I thought it might be better if we tried giving her the crampons, and me keeping the axe: though her boots aren&apos;t crampon-rated, my crampons are pretty flexible. The ground was nasty and steep and strewn with rocks, so I decided to traverse round to the right: it looked like there would be a shallower descent along that way. So we traversed along the slope for a while, until we got to a really big, steep snow slope. At least 100 metres long, maybe 150. Maybe even 200. It&apos;s bloody hard to judge distances when you&apos;re standing on top of them, peering down and thinking &quot;how the hell am I going to get down that? NB: all distances in this post should be assumed to have been calculated using FearCam(TM).&lt;br /&gt;&lt;br /&gt;The snow was, needless to say, horrible: a coherent layer of thin ice lay on top of it, meaning that my boots would slip out from under me if I tried to stand on it. I might be able to kick steps in it, supporting myself with the axe. Or... it looked like there was a wide streak of powder snow a couple of metres out. It might just be covering more ice, of course, but it could be easier to descend.&lt;br /&gt;&lt;br /&gt;&quot;OK, Jo, it looks a bit easier to descend on that streak of powder. It might be easier for you to traverse this bit if you turn face-on to the slope and kick your toes in.&quot;&lt;br /&gt;&lt;br /&gt;I turned back to face the slope and set off across the ice. Behind me, there was a yelp. I turned to see Jo sliding down the slope again. I don&apos;t remember this part, but apparently she was shouting &quot;Help! Help!&quot;, even though she knew that I was the only one who could possibly hear her and there was nothing I could do.&lt;br /&gt;&lt;br /&gt;I had the axe: she&apos;d have to use her hands and feet to stop herself. On ice. Oh God no. I hope she knows not to dig crampons in... oh God, she&apos;s actually bouncing and rolling! Fuckfuckfuckfuckfuck. Stop, Jo, stop, please stop... but she carried on all the way to the bottom of the snow slope, rolling and crumpling like a rag doll. I hope she still has her glasses, I thought,  because there&apos;s no way I&apos;m going to find them otherwise.&lt;br /&gt;&lt;br /&gt;I had to get down to her ASAP, which meant another glissade. Fortunately, I had the axe this time, and could use it to control my speed and direction. I tried sitting down, but couldn&apos;t get the axe in far enough, so I settled for turning side-on to the slope and sliding down on my thighs, holding onto the axe with both hands and dragging it down the ice. It was at this point that I really grew to love and appreciate my ice axe. No red spots this time, thank God, and Jo was kneeling up by the time I was half-way down - she knew she had to get up quickly to show me that she was still mobile.&lt;br /&gt;&lt;br /&gt;My arms and shoulders were sore from the effort by the time I got down, but the important thing was that Jo was OK, albeit badly shaken. A quick check of her face showed no fresh blood, and she didn&apos;t have any other injuries - we&apos;d been incredibly lucky. But we still had a big problem: we now only had an hour and a half to sunset, we were a long way down the side of the ridge, and, thanks to all our traversing round to find an easier way down, we were quite a long way off course. There was a big flat plain below us to the right, but if we descended down there in search of flatter ground, we&apos;d have to re-gain all the height later in order to find the path back through the trees, and gaining height takes time and energy. We tried what looked like a flat bit slightly above us and further on, but it turned out to be no good - flatter than where we were, but still too steep to traverse across comfortably, especially with Jo&apos;s increasingly shaky legs. It didn&apos;t help that we were now in shadow; this, coupled with Jo&apos;s monocular vision, made it hard to determine the consistency of the snow. I spotted a long streak where the grass poked through the snow: reasoning that this would be less icy, we traversed over to there and then sidestepped down to the plateau. Plant axe, left foot, right foot, plant axe, left foot, right foot, repeat. We&apos;d lost a lot of height, but now at least we were on ground we could walk on safely.&lt;br /&gt;&lt;br /&gt;Another quarter of an hour or so later and we were back on the ridge, past the original obstruction. Looking back at it, it was clear that we should have tried to skirt it to the left, where it was much gentler. The slope we&apos;d come down looked insane, but largely because the shallower sections we&apos;d used were out of sight.&lt;br /&gt;&lt;br /&gt;Daylight was still a worry, though, especially because we were still in snow. Looking across the valley, we could see how high the snowline was above the valley floor, and our reassuring claims that the snowline would be lower in north-facing corries rang a bit hollow. We pressed on - there was nothing else to do - with me casting the odd look at Jo&apos;s face to check that there wasn&apos;t any new blood. Eventually, the snow petered out, Jo took her crampons off, and I put the axe away. We came to a wire fence, with what looked like a stile on the other side of the stream, and a path (an actual path! Or at least a sheep track) beyond it. There were a few stepping stones across just above it, but Jo, only having one eye, needed to be guided across. Of course, once we were across the stile turned out not to be any use at all: all the planks were broken, and there were rusty nails poking out of it. In the end, we just climbed over the fence. We carried on down the path for a while, but it eventually became obvious that it wasn&apos;t the one we needed. It was now about two hours since the accident, and the light was definitely going. Out came the GPS set, which revealed that - mirabile dictu! - the path we needed was actually only about a hundred yards away on our right, but out of sight beyond a small rise. First, of course, there was another bloody river crossing to negotiate, but again we were lucky, and this one didn&apos;t take us too much time. Once over the hill, we found the track almost immediately - a wide Land Rover track, leading away into the forest, and not a moment too soon.&lt;br /&gt;&lt;br /&gt;I&apos;d spent much of the morning cursing myself for dismissing this track at the beginning, but actually avoiding it hadn&apos;t been such a bad idea - it took some long, winding detours, and it took us over two hours to walk back to the car park. We were both very glad I&apos;d chased after the Alpen bars. At the end, it was completely dark, and we were negotiating obstacles with torches. Fortunately, there was a group of houses near the car park which had lights in their windows, so we had some measure of how far away we were. At last, at 8pm, about four hours after the first accident, we made it back to the car.&lt;br /&gt;&lt;br /&gt;It was at this point that the pain in my testicle announced that it wasn&apos;t going to let me ignore it any more.&lt;br /&gt;&lt;br /&gt;Some medical background: about eleven years ago, I suffered a &lt;a href=&quot;http://en.wikipedia.org/wiki/Testicular_torsion&quot;&gt;testicular torsion&lt;/a&gt;, which was the most painful experience I hope ever to undergo. It was fixed surgically, and after a couple of weeks in bed and another couple having to climb staircases using the banisters and my arms, I was OK again; but it&apos;s left me susceptible to occasional bouts of infection, and the swelling and tenderness revealed by a quick check suggested that this was another such episode. The last one was a few years ago: obviously, they&apos;d chosen this moment in order to be maximally annoying. Of course, it was the Saturday of Easter weekend, and I wasn&apos;t going to be able to see my doctor until Tuesday, so it looked like I would be going to Accident and Emergency as a patient in my own right. Jo wasn&apos;t up to driving, and so after a quick call to &lt;span class=&apos;ljuser&apos; lj:user=&apos;wormwood_pearl&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/&apos;&gt;&lt;b&gt;wormwood_pearl&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; to let her know I wouldn&apos;t be home for a while, I drove off, trying to keep my legs as far apart as possible.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid3&quot;&gt;&lt;/a&gt;&lt;h3&gt;A&amp;E and TMI&lt;/h3&gt;We reckoned that the nearest hospital with an A&amp;E department was in Paisley, but by the time we&apos;d driven all the way to Paisley we might as well have gone to Glasgow. It was now probably too late to avoid the Saturday night rush entirely, but Jo thought that the Southern was probably going to be the quietest of the various Glasgow hospitals, and besides, she knew the way there. First, of course, we had to drive to Glasgow, which meant the road alongside Loch Lomond. A few years ago, this was apparently voted the worst main road in Britain. They&apos;re resurfacing it piece-by-piece, but they&apos;ve got a way to go yet. It&apos;s narrow, windy, bumpy, and unlit - just what you want when you&apos;ve got sore baws :-(&lt;br /&gt;&lt;br /&gt;We arrived in A&amp;E at about 10pm, to find an almost empty waiting room and an LED sign reading &quot;Patients will be seen in order of severity of symptoms. Approximate waiting time 2hrs&quot;. A bit surprising in view of how empty the place was, but still a lot better than any of my previous A&amp;E trips. Jo registered with the (incredibly friendly) receptionist, who offered her a blanket, and then I did the same, slightly sheepishly. I didn&apos;t get a blanket, though. We sat for a while, not really feeling like reading the books we&apos;d brought with us. The (black, male, presumably African) triage nurse called for Jo after a while, and when she came out he&apos;d cleaned her up, and replaced the dressing with a plaster. I think we were both feeling pretty silly about wasting NHS time on what was obviously a very minor injury, but he&apos;d said that the doctor would see her in a while, so it couldn&apos;t be &lt;i&gt;completely&lt;/i&gt; trivial. Then he called me into the triage room, and asked me to describe my symptoms. I told him about the pain and swelling, and about the torsion; he said that because of the torsion he&apos;d bump me up the priority list, and offered me some paracetamol for the pain (which I very gratefully accepted). He asked me why I&apos;d let Jo fall. &quot;It wasn&apos;t my fault,&quot; I said. &quot;Yes it was, it was your fault,&quot; he replied. I dunno, maybe he was right. I gave a urine sample (into a cardboard sample bottle - I guess it saves on washing up...), took the paracetamol, and took the opportunity to drink several glasses of water from the cooler, as I was pretty thirsty.&lt;br /&gt;&lt;br /&gt;I went back out and sat in the waiting room, and waited. Various people arrived, registered and were triaged; every so often, a doctor would come out and call a name to be seen. The paracetamol was kicking in, and the pain wasn&apos;t too bad, provided I didn&apos;t try to do anything stupid like put my legs together. After we&apos;d been there for an hour, I was called through, along with another patient. I was surprised to be seen so quickly, especially as I was meant to be the one escorting the casualty! The doctor (female, dyed red hair, English accent, surprisingly young-looking - I must be getting old) led us to separate curtained areas, handed me a gown, a blanket, and a bag for my clothes, and told me to change. I changed, and then sat and waited for her to deal with her other patient. I heard the other patient say &quot;Sorry for wasting your time&quot;, to be met with &quot;Oh, you&apos;re not wasting my time!&quot; Nice to know it&apos;s not just me, I thought, and decided not to say that to her.&lt;br /&gt;&lt;br /&gt;The doctor came through, chatted briefly, examined me, and diagnosed me with &lt;a href=&quot;http://en.wikipedia.org/wiki/Epididymitis&quot;&gt;Epididymitis&lt;/a&gt;, which was more-or-less what I expected. The most common cause of epididymitis in young men is sexually-transmitted urinary tract infections, but more or less everything else about my case argues against this explanation (chiefly that I haven&apos;t been sleeping around). Probably a random UTI, brought on by stress and dehydration. She gave me a mixture of painkillers and anti-inflammatories, and prescribed two weeks&apos; worth of antibiotics (they didn&apos;t have any to give me at the time). I got back into my clothes, waited for the pills to arrive, and went back into the waiting room. It was only 11.15 - I&apos;d been treated within an hour and a quarter of arriving, on a Saturday night. Not bad :-) &lt;br /&gt;&lt;br /&gt;Jo had got into a conversation with a woman who&apos;d been at an ice-hockey game and been hit by the puck. She had a big mess of blood-matted hair in the side of her head, which clashed rather with her highlights, but her team had won, so she was pretty cheerful. I tried the vending machine, but it was sold out of everything; then we remembered that there were some chocolate and peanuts left in the car, so I went out to get them so I could take some diclofenac. We sat around for a bit longer waiting for Jo to be seen, trying to decide whether it was worth sticking around. The wound had long since stopped bleeding, but Jo was having to keep her eyebrows immobile to stop it opening again. At about twenty past midnight the same doctor who&apos;d seen me called for Jo, and a few minutes later Jo emerged, with her wound glued together and covered with steri-strips. We were out by half-past midnight, which was seriously impressive given the time of day and the minor nature of our injuries: I think they must have been clearing the decks for the post-pub rush. Jo was feeling up to driving by now, so she gave me a lift home. &lt;span class=&apos;ljuser&apos; lj:user=&apos;wormwood_pearl&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://wormwood-pearl.livejournal.com/&apos;&gt;&lt;b&gt;wormwood_pearl&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; had gone to bed, but left me dinner in the oven: it had gone cold, but I was far too hungry (and it was far too tasty) for me to care :-)&lt;br /&gt;&lt;br /&gt;All in all, not exactly &lt;i&gt;Touching the Void&lt;/i&gt;, but it had some frightening moments.&lt;br /&gt;&lt;br /&gt;&lt;a name=&quot;cutid4&quot;&gt;&lt;/a&gt;&lt;h3&gt;Lessons Learned:&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;River crossings can take bloody ages, and can leave you with cold, wet feet, which are very much a Bad Thing. Jo wasn&apos;t sure, but reckoned that may have contributed to her second fall. Time to cross rivers should be factored in when planning routes.&lt;/li&gt;&lt;li&gt;Even if the weather&apos;s fine, bad snow conditions can make a walk dangerous. The weather on Saturday was some of the best I&apos;ve ever had, but we still managed to get into trouble because of the poor snow.&lt;/li&gt;&lt;li&gt;Plan for the weakest member of the expedition, not the strongest. I&apos;ve been out hiking in some truly atrocious weather with Jo, and she&apos;s a good person to hike with, but her experience in summer walking and skiing wasn&apos;t enough to make up for her inexperience walking on snow. And I&apos;m not exactly &lt;a href=&quot;http://en.wikipedia.org/wiki/Reinhold_Messner&quot;&gt;Reinhold Messner&lt;/a&gt; myself - in fact, I&apos;m wondering if &quot;mountaineering inexperience&quot; would have been a better title for this post. Still, I think we both gained a few XP that day.&lt;/li&gt;&lt;li&gt;Always keep the navigational Big Picture in mind. Trying to go around local difficulties by going the way that seemed most obvious, without any thought of our overall route, meant that we got quite badly off course, both when crossing the river and when descending the ridge.&lt;/li&gt;&lt;li&gt;I&apos;m not sure what to think about safety gear. Having a full set of crampons and axes would certainly have helped, but then again, having the gear we did probably encouraged us to get out of our depth. And crampons and axes are expensive. Helmets, in retrospect, would probably have been a good idea, especially since we each had one sitting at home. I&apos;m wondering now if we should have been roped together once we got onto the steep slope: of course, we didn&apos;t have ropes with us, so that wasn&apos;t an option. It&apos;s a tricky balance: you don&apos;t want to weigh yourself down with a load of unnecessary kit. Ropes, in particular, are heavy, and I&apos;ve never needed one before.&lt;/li&gt;&lt;li&gt;We kept talking about changing Jo&apos;s dressing, but never actually did: this meant that she spent hours walking while only being able to see with one eye. We were never in an ideal situation to do it, but we should probably have prioritised it higher.&lt;/li&gt;&lt;li&gt;I should probably take a careful look through the first-aid kit, and check it&apos;s full of sensible stuff. I&apos;ve already bought replacements for the bits I used.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Edit:&lt;/b&gt; Make sure everyone in the party knows how to use the gear properly. In particular, self-arrests should be practised (thanks to &lt;span class=&apos;ljuser&apos; lj:user=&apos;bronxelf_ag001&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://bronxelf-ag001.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://bronxelf-ag001.livejournal.com/&apos;&gt;&lt;b&gt;bronxelf_ag001&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Time to throw it open to the floor: &lt;b&gt;what should I have done differently?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;[&lt;b&gt;Edit:&lt;/b&gt; some photos of the trip can be seen &lt;a href=&quot;http://moblog.co.uk/view.php?id=317416&quot;&gt;here&lt;/a&gt;.]</description>
  <comments>http://pozorvlak.livejournal.com/98058.html</comments>
  <category>healthcare</category>
  <category>mountains</category>
  <category>doomed</category>
  <category>munros</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/97943.html</guid>
  <pubDate>Wed, 19 Mar 2008 17:08:15 GMT</pubDate>
  <title>Nice probability question</title>
  <link>http://pozorvlak.livejournal.com/97943.html</link>
  <description>Here&apos;s a nice question from a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sixth_Term_Examination_Paper&quot;&gt;Cambridge entrance paper&lt;/a&gt; that some of you might enjoy:&lt;blockquote&gt;You have a biased coin that comes up heads with probability &lt;i&gt;p&lt;/i&gt;. With it, you play the following game: you toss the coin repeatedly, scoring 1 each time it comes up heads and 0 each time it comes up tails, and stop when you toss two tails in a row.&lt;ol&gt;&lt;li&gt;What is E, the expected number of tosses in a round of the game?&lt;/li&gt;&lt;li&gt;What is S, your expected score from one round (i.e. the expected number of heads tossed)?&lt;/li&gt;&lt;li&gt;Now suppose the rules are changed, so that you only stop the game after tossing &lt;i&gt;r&lt;/i&gt; consecutive tails. What are the new values of E and S?&lt;/li&gt;&lt;/ol&gt;&lt;/blockquote&gt; The question wasn&apos;t quite as stated: it actually included some extra information, which was useful but nonessential. In deference to the fact that many of you have much greater mathematical experience than the average Cambridge applicant, I&apos;ve hidden it under &lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;a cut, and whited the text out - select to see it.&lt;br /&gt;&lt;br /&gt;Hint for part 1:&lt;br /&gt;&lt;font color=&quot;white&quot;&gt;E satisfies the equation&lt;br /&gt;&lt;br /&gt;E = p(1+E) + p(1-p)(2+E) + (1-p)(1-p)2&lt;br /&gt;&lt;br /&gt;The question asked candidates to first derive this equation, and then solve it for E.&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Hint for part 3:&lt;br /&gt;&lt;font color=&quot;white&quot;&gt;As before, candidates were given an expression for E, and asked to derive it:&lt;br /&gt;&lt;br /&gt;E = (1-q&lt;small&gt;&lt;sup&gt;r&lt;/sup&gt;&lt;/small&gt;)/pq&lt;small&gt;&lt;sup&gt;r&lt;/sup&gt;&lt;/small&gt;&lt;br /&gt;&lt;br /&gt;where &lt;i&gt;q&lt;/i&gt; = 1 - &lt;i&gt;p&lt;/i&gt;.&lt;/font&gt;</description>
  <comments>http://pozorvlak.livejournal.com/97943.html</comments>
  <category>teaching</category>
  <category>maths</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/97767.html</guid>
  <pubDate>Wed, 12 Mar 2008 15:03:11 GMT</pubDate>
  <link>http://pozorvlak.livejournal.com/97767.html</link>
  <description>My paper was rejected. Not enough new material, and I&apos;d failed to cite related work.&lt;br /&gt;&lt;br /&gt;As well as being annoying, this is worrying: the paper contained almost all the new material that&apos;s in my thesis, strongly suggesting that my thesis doesn&apos;t contain enough new material either.&lt;br /&gt;&lt;br /&gt;Bugger.&lt;br /&gt;&lt;br /&gt;On the upside, the reviewer suggested some possible applications and further work: if I could do that, maybe that would be enough.</description>
  <comments>http://pozorvlak.livejournal.com/97767.html</comments>
  <category>thesis</category>
  <category>doomed</category>
  <category>tests of character</category>
  <category>maths</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/97529.html</guid>
  <pubDate>Mon, 10 Mar 2008 21:01:02 GMT</pubDate>
  <title>Minor annoyances</title>
  <link>http://pozorvlak.livejournal.com/97529.html</link>
  <description>A guy on Reddit pointed me at &lt;a href=&quot;http://en.wikipedia.org/wiki/Donald_Davies&quot;&gt;this article&lt;/a&gt; today. It&apos;s the Wikipedia biography of the Welsh computer scientist Donald Davies. Like my father, he was from the Rhondda Valley; he was the co-inventor of packet-switched networks (like this big one you&apos;re using right now); and he once found a bug in &lt;i&gt;Alan Turing&lt;/i&gt;&apos;s code, &lt;i&gt;before the first computer had been built&lt;/i&gt; :-)&lt;br /&gt;&lt;br /&gt;I think he may be my new hero.&lt;br /&gt;&lt;br /&gt;In other news:&lt;ul&gt;&lt;li&gt;I&apos;ve just finished &lt;i&gt;Portal&lt;/i&gt;. It was great, but far too short :-( If you haven&apos;t played it yet, then you should go and buy/download a copy &lt;i&gt;right now&lt;/i&gt;, and cover your ears and sing &quot;La la la la la...&quot; until it&apos;s loaded to avoid being spoilered like I was. The puzzles are still a lot of fun, but the plot and jokes would have been a lot better if I hadn&apos;t half-known they were coming.&lt;br /&gt;[And I didn&apos;t find &quot;The Cake is a Lie!&quot;, even though I was looking out for it...]&lt;/li&gt;&lt;li&gt;Spent a lot of time sitting at the computer today, but didn&apos;t get any thesis done. Bah.&lt;/li&gt;&lt;li&gt;After a similarly unproductive morning yesterday, I went to the climbing wall, and had quite a good session: I did two 6as (which is good, for me), led a widely-agreed-to-be-undergraded 5+, and finally knocked off a 5+ with a big scary overhang that had been tormenting me for months. Yay!&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://smuglispweeny.blogspot.com/2008/03/my-biggest-lisp-project.html&quot;&gt;This&lt;/a&gt; may be the most awe-inspiring programming war story I&apos;ve ever read.&lt;/li&gt;&lt;li&gt;Letter from Linacre: I didn&apos;t get the job. Never mind.&lt;/li&gt;&lt;li&gt;The winter mountaineering course I was booked on next weekend has been cancelled due to lack of interest. Just when the snow&apos;s started up again! I&apos;m much more annoyed about that than about the rest, to be honest.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Ah well, tomorrow will be better. Anyway, have a look at this video, which is the trailer for one of the films I saw at the mountain film festival on Saturday:&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;4&quot; /&gt;&lt;br /&gt;&lt;br /&gt;That sea arch he&apos;s climbing up the underside of, by the way, is provisionally graded as a French 9b :-)</description>
  <comments>http://pozorvlak.livejournal.com/97529.html</comments>
  <category>lisp</category>
  <category>jobs</category>
  <category>programming</category>
  <category>games</category>
  <category>computers</category>
  <category>mountains</category>
  <category>maths</category>
  <category>rock climbing</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/97263.html</guid>
  <pubDate>Sun, 09 Mar 2008 13:19:44 GMT</pubDate>
  <title>No hills this week :-(</title>
  <link>http://pozorvlak.livejournal.com/97263.html</link>
  <description>Its hailing outside. The forecast for the hills this weekend was -13C after windchill, and gusting winds of up to 50mph - we&apos;ve been out in much worse, but there was also the danger of blizzards, which would have been a problem. Plus Philipp&apos;s away, and Michael and Jo are busy this weekend, so the walk would have been me and someone else less experienced. I&apos;m not going walking on my own in a blizzard, and while Bart, say, is a sensible guy with his head firmly screwed on and a few walks under his belt, I really didn&apos;t feel like taking him out in those conditions&lt;small&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/small&gt;. So I&apos;m sat here at home, failing to work on my thesis. Bah. My last hillwalk was two weeks ago now, and I&apos;m starting to get the been-in-the-city-too-long shivers. Rock climbing&apos;s fun, but doesn&apos;t quite hit the same spot, particularly when it&apos;s indoors.&lt;br /&gt;&lt;br /&gt;Going to the &lt;a href=&quot;http://super7.co.uk/events.php&quot;&gt;Adventure Film Festival&lt;/a&gt; yesterday didn&apos;t help, either...&lt;br /&gt;&lt;br /&gt;&lt;span class=&apos;ljuser&apos; lj:user=&apos;firefliesinjune&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://firefliesinjune.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://firefliesinjune.livejournal.com/&apos;&gt;&lt;b&gt;firefliesinjune&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;: I haven&apos;t forgotten about my promise to take you to the Highlands, but let&apos;s wait for the weather to improve, eh? :-)&lt;br /&gt;&lt;br /&gt;&lt;small&gt;&lt;sup&gt;1&lt;/sup&gt; Maybe I should have left that choice up to him, I dunno.&lt;/small&gt;</description>
  <comments>http://pozorvlak.livejournal.com/97263.html</comments>
  <category>cold</category>
  <category>mountains</category>
  <category>scotland</category>
  <category>munros</category>
  <lj:security>public</lj:security>
</item>
<item>
  <guid isPermaLink='true'>http://pozorvlak.livejournal.com/96851.html</guid>
  <pubDate>Sun, 09 Mar 2008 12:41:12 GMT</pubDate>
  <title>Lockhart&apos;s Lament</title>
  <link>http://pozorvlak.livejournal.com/96851.html</link>
  <description>Everyone needs to read this piece, &lt;i&gt;especially&lt;/i&gt; those who don&apos;t consider themselves mathematicians.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.maa.org/devlin/LockhartsLament.pdf&quot;&gt;A Mathematician&apos;s Lament, by Paul Lockhart&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There&apos;s a bit of biographical information on the author &lt;a href=&quot;http://www.maa.org/devlin/devlin_03_08.html&quot;&gt;here&lt;/a&gt;. It&apos;s a &lt;i&gt;cri de coeur&lt;/i&gt; about the state of mathematics education in the USA (and, by extension, in every industrialised country), which convinces generation after generation of kids that maths is boring and ritualistic, rather than the artful, elegant form of play that it really is. It&apos;s a bit long, but thoroughly, thoroughly excellent.&lt;blockquote&gt;A     musician wakes from a terrible nightmare. In his dream he finds himself in a society where      music education has been made mandatory. “We are helping our students become more competitive in an increasingly sound-filled world.” Educators, school systems, and the state are put in charge of this vital project. Studies are commissioned, committees are formed, and decisions are made— all without the advice or participation of a single working musician or composer.&lt;br /&gt;&lt;br /&gt;    Since musicians are known to set down their ideas in the form of sheet music, these curious black dots and lines must constitute the “language of music.” It is imperative that students become fluent in this language if they are to attain any degree of musical competence; indeed, it would be ludicrous to expect a child to sing a song or play an instrument without having a thorough grounding in music notation and theory. Playing and listening to music, let alone composing an original piece, are considered very advanced topics and are generally put off until college, and more often graduate school.&lt;br /&gt;&lt;br /&gt;    As for the primary and secondary schools, their mission is to train students to use this language— to jiggle symbols around according to a fixed set of rules: “Music class is where we take out our staff paper, our teacher puts some notes on the board, and we copy them or transpose them into a different key. We have to make sure to get the clefs and key signatures right, and our teacher is very picky about making sure we fill in our quarter-notes completely. One time we had a chromatic scale problem and I did it right, but the teacher gave me no credit because I had the stems pointing the wrong way.”&lt;br /&gt;&lt;br /&gt;    In their wisdom, educators soon realize that even very young children can be given this kind of musical instruction. In fact it is considered quite shameful if one’s third-grader hasn’t completely memorized his circle of fifths. “I’ll have to get my son a music tutor. He simply won’t apply himself to his music homework. He says it’s boring. He just sits there staring out the window, humming tunes to himself and making up silly songs.”&lt;br /&gt;&lt;br /&gt;     In the higher grades the pressure is really on. After all,  the students must be prepared for the standardized tests and college admissions exams. Students must take courses in Scales and Modes, Meter, Harmony, and Counterpoint. “It’s a lot for them to learn, but later in college when they finally get to hear all this stuff, they’ll really appreciate all the work they did in high school.” Of course, not many students actually go on to concentrate in music, so only a few will ever get to hear the sounds that the black dots represent.&lt;/blockquote&gt; &lt;span class=&apos;ljuser&apos; lj:user=&apos;icedragon1969&apos; style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;http://icedragon1969.livejournal.com/profile&apos;&gt;&lt;img src=&apos;http://p-stat.livejournal.com/img/userinfo.gif&apos; alt=&apos;[info]&apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;http://icedragon1969.livejournal.com/&apos;&gt;&lt;b&gt;icedragon1969&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;: he has some hard words about high-school geometry, too.</description>
  <comments>http://pozorvlak.livejournal.com/96851.html</comments>
  <category>teaching</category>
  <category>doomed</category>
  <category>maths</category>
  <category>links</category>
  <lj:security>public</lj:security>
</item>
</channel>
</rss>
