<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3826164796564330590</id><updated>2011-09-08T08:04:27.883+02:00</updated><category term='pappus'/><category term='math'/><category term='IO'/><category term='maths'/><category term='tutorial'/><category term='icfp'/><category term='monad'/><category term='unmonad'/><category term='ghost'/><category term='folds'/><category term='proof'/><category term='dna'/><category term='geometry'/><category term='universality'/><category term='turing'/><category term='junk dna'/><category term='primes'/><category term='wolfram'/><category term='fuun defense'/><category term='haskell'/><category term='endo'/><category term='mean'/><category term='euclid'/><category term='beautiful code'/><category term='compiler'/><category term='fuun'/><category term='superghost'/><title type='text'>The Most Fuun You Can Have</title><subtitle type='html'>For the augmentation of the complexity and intensity of the field of intelligent life.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://squing.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-4299412896295927181</id><published>2008-11-07T11:38:00.003+02:00</published><updated>2008-11-07T23:59:10.536+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='beautiful code'/><category scheme='http://www.blogger.com/atom/ns#' term='haskell'/><category scheme='http://www.blogger.com/atom/ns#' term='mean'/><category scheme='http://www.blogger.com/atom/ns#' term='folds'/><title type='text'>Beautiful folding</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&gt; {-# LANGUAGE ExistentialQuantification #-}&lt;br /&gt;&lt;br /&gt;&gt; import Data.List (foldl')&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If you're not a Haskeller, and were thus hoping to learn how to fold a shirt beautifully, I'm afraid you're out of luck. I don't know either.&lt;br /&gt;&lt;br /&gt;Much has been said about writing a Haskell function to calculate the mean of a list of numbers. For example, see Don Stewart's &lt;a href="http://cgi.cse.unsw.edu.au/~dons/blog/2008/05/16"&gt;"Write Haskell as fast as C"&lt;/a&gt;. Basically, one wants to write "nice, declarative" code like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; naiveMean :: Fractional a =&gt; [a] -&gt; a&lt;br /&gt;&gt; naiveMean xs = sum xs / fromIntegral (length xs)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;but if &lt;code&gt;xs&lt;/code&gt; is large, &lt;code&gt;sum&lt;/code&gt; will bring the whole thing into memory, but the garbage collector won't be able to collect it, since we still need it to calculate the length.&lt;br /&gt;&lt;br /&gt;The solution is to calculate both the sum and the length in one pass, and it's usually written something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; uglyMean :: Fractional a =&gt; [a] -&gt; a &lt;br /&gt;&gt; uglyMean xs = divide $ foldl' f (P 0 0) xs&lt;br /&gt;&gt;     where &lt;br /&gt;&gt;         f :: Num a =&gt; Pair a Int -&gt; a -&gt; Pair a Int&lt;br /&gt;&gt;         f (P s l) x = P (s + x) (l + 1) &lt;br /&gt;&gt;         divide (P x y) = x / fromIntegral y&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;where &lt;code&gt;P&lt;/code&gt; is a strict pair constructor. This works, but where is the elegance, abstraction and modularity that Haskell is supposed to be famous for? Don's solution is even uglier (sorry, Don): not only does he write the reductor (our &lt;code&gt;f&lt;/code&gt;) explicitly, but also the fold itself.&lt;br /&gt;&lt;br /&gt;What I hope to do here is to abstract this pattern away, by making "combinable folds". I only do &lt;code&gt;foldl'&lt;/code&gt;, although &lt;code&gt;foldl1'&lt;/code&gt; could be handy.&lt;br /&gt;&lt;br /&gt;To make folds combinable, we need to turn folds into data: a fold is a function (the reductor) with an initial value. To make folds more readily combinable, we add a post-processing function (here it is &lt;code&gt;divide&lt;/code&gt;). Now that we have the post-processor, we don't need to look at the accumulator directly, so we make it existential. The type &lt;code&gt;Fold b c&lt;/code&gt; is for folds overs lists of type &lt;code&gt;[b]&lt;/code&gt;, with&lt;br /&gt;results of type &lt;code&gt;c&lt;/code&gt;.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; data Fold b c = forall a. F (a -&gt; b -&gt; a) a (a -&gt; c)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We'll need a strict pair type, and I don't want to give my blog a dependency on the strict package, so I introduce my own:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; data Pair a b = P !a !b&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now that folds are data, we can start manipulating them. For example, we can&lt;br /&gt;combine two folds to get a pair of results (we make the result an ordinary tuple for convenience, but use strict pairs for the accumulator to get the rightstrictness). The &lt;code&gt;(***)&lt;/code&gt; defined here is like the one in &lt;code&gt;Control.Arrow&lt;/code&gt;, but takes a strict pair as input. The reductor (&lt;code&gt;comb f g&lt;/code&gt;) is basically &lt;code&gt;(first f) . (second g)&lt;/code&gt; for strict pairs.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; both :: Fold b c -&gt; Fold b c' -&gt; Fold b (c, c')&lt;br /&gt;&gt; both (F f x c) (F g y c') = F (comb f g) (P x y) (c *** c')&lt;br /&gt;&gt;     where&lt;br /&gt;&gt;         comb f g (P a a') b = P (f a b) (g a' b)&lt;br /&gt;&gt;         (***) f g (P x y) = (f x, g y)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Our next combinator simply adds an extra post-processor.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; after :: Fold b c -&gt; (c -&gt; c') -&gt; Fold b c'&lt;br /&gt;&gt; after (F f x c) d = F f x (d . c)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The next one, bothWith, is a combination of both and after.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; bothWith :: (c -&gt; c' -&gt; d) -&gt; Fold b c -&gt; Fold b c' -&gt; Fold b d&lt;br /&gt;&gt; bothWith combiner f1 f2 = after (both f1 f2) (uncurry combiner)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now that we have tools to build folds, we want to actually fold them, so here is combinator &lt;code&gt;foldl'&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; cfoldl' :: Fold b c -&gt; [b] -&gt; c&lt;br /&gt;&gt; cfoldl' (F f x c) = c . (foldl' f x)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now lets see a few basic folds:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; sumF :: Num a =&gt; Fold a a&lt;br /&gt;&gt; sumF = F (+) 0 id&lt;br /&gt;&lt;br /&gt;&gt; productF :: Num a =&gt; Fold a a&lt;br /&gt;&gt; productF = F (*) 1 id&lt;br /&gt;&lt;br /&gt;&gt; lengthF :: Fold a Int&lt;br /&gt;&gt; lengthF = F (const . (+1)) 0 id&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And, the moment we've all been waiting for, combining basic folds to get the mean of a list:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; meanF :: Fractional a =&gt; Fold a a&lt;br /&gt;&gt; meanF = bothWith (/) sumF (after lengthF fromIntegral)&lt;br /&gt;&lt;br /&gt;&gt; mean :: Fractional a =&gt; [a] -&gt; a&lt;br /&gt;&gt; mean = cfoldl' meanF&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Pretty simple, eh? Perhaps not quite as pretty as naiveMean, but best of all, it doesn't eat your memory and kill your swap like naiveMean does.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; main = do&lt;br /&gt;&gt;         let xs = [1..10000000]&lt;br /&gt;&gt;         print $ mean xs&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Compiling with GHC 6.8.2 and -O2, this runs in about 1.2 seconds (on my three-year-old laptop) and uses less than a meg of memory. GHC generates the same code for mean and uglyMean. [Originally &lt;code&gt;uglyMean&lt;/code&gt; was slightly faster, but this was because of type defaulting: the result of &lt;code&gt;lengthF&lt;/code&gt; defaulted to &lt;code&gt;Integer&lt;/code&gt;]&lt;br /&gt;&lt;br /&gt;One thing remains. What do Haskellers do when there's a pretty way and a fast way (or at least a way that's more susceptible to optimisation) to do the same thing? We write rewrite rules. So we'd like to convert sum, length, etc. into combinable folds, and then combine them. Something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; {-&lt;br /&gt;&gt; {-# RULES&lt;br /&gt;&gt; "sum/sumF"         sum = cfoldl' sumF&lt;br /&gt;&gt; "product/productF" product = cfoldl' productF&lt;br /&gt;&gt; "length/lengthF"   length = cfoldl' lengthF&lt;br /&gt;&gt; "multi-cfoldl'"    forall c f g xs. c (cfoldl' f xs) (cfoldl' g xs) &lt;br /&gt;&gt;                                         = cfoldl' (bothWith c f g) xs&lt;br /&gt;&gt;  #-}&lt;br /&gt;&gt; -}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So why are these commented out? Unfortunately, GHC doesn't like the&lt;br /&gt;all-important "multi-foldl'" rule: it doesn't have a named function at its head (it has the variable c). GHC doesn't allow rules of this form, presumably for efficiency and simplicity in the compiler.&lt;br /&gt;&lt;br /&gt;So unfortunately, we can't go back to writing pretty-but-naive code, but with these combinators at our disposal, we are at least saved from writing *ugly* code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-4299412896295927181?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/4299412896295927181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2008/11/beautiful-folding.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/4299412896295927181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/4299412896295927181'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2008/11/beautiful-folding.html' title='Beautiful folding'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-6240161582796627798</id><published>2008-03-10T19:46:00.000+02:00</published><updated>2008-03-10T20:17:12.222+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maths'/><category scheme='http://www.blogger.com/atom/ns#' term='pappus'/><category scheme='http://www.blogger.com/atom/ns#' term='euclid'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><category scheme='http://www.blogger.com/atom/ns#' term='geometry'/><title type='text'>Mathematics for Arithmeticians: Pons asinorum</title><content type='html'>In today's post, I will show Pappus's proof of the so-called &lt;em&gt;Pons asinorum&lt;/em&gt; or Bridge of Asses. The theorem is given this name because it is the first difficult theorem in Euclid's &lt;em&gt;Elements&lt;/em&gt;. The theorem states that the base angles of an isosceles triangle are equal.&lt;br /&gt;&lt;br /&gt;Consider triangle ABC, with AB = BC. Now we want to prove that angle A is equal to angle C. One useful trick in geometry for proving things equal is to use congruence of triangles, but we only have &lt;em&gt;one&lt;/em&gt; triangle.&lt;br /&gt;&lt;br /&gt;Or do we? Pappus' trick is to look at one triangle two ways: ABC and its reflection CBA. AB = CB (by our starting assumption), BA = BC (by the same assumption), and AC = CA (they're the same line). So ABC ≡ CBA (all three corresponding sides are equal, so they're congruent). Since they're congruent, the corresponding angles are equal: angle A equals angle B.&lt;br /&gt;&lt;br /&gt;That's it. This trick allows us to prove the theorem in just a few steps.&lt;br /&gt;&lt;br /&gt;Why do I think this elegant? By looking at one thing in two ways, we learnt something new, and remarkably quickly. And the great thing is that you can use this trick again, to prove the converse using angle-side-angle congruence. And a trick you can use more than once is a technique.&lt;br /&gt;&lt;br /&gt;If you followed this, well done. You have crossed the Bridge of Asses.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-6240161582796627798?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/6240161582796627798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2008/03/mathematics-for-arithmeticians-pons.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/6240161582796627798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/6240161582796627798'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2008/03/mathematics-for-arithmeticians-pons.html' title='Mathematics for Arithmeticians: Pons asinorum'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-8851346040023677065</id><published>2008-03-03T19:10:00.005+02:00</published><updated>2008-03-03T20:58:09.778+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='proof'/><category scheme='http://www.blogger.com/atom/ns#' term='maths'/><category scheme='http://www.blogger.com/atom/ns#' term='primes'/><category scheme='http://www.blogger.com/atom/ns#' term='euclid'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Mathematics for Arithmeticians: Prime Numbers</title><content type='html'>I've decided to stop calling myself a computer science student &amp;mdash; I got tired of being &lt;em&gt;the computer guy&lt;/em&gt; &amp;mdash; and go for mathematics instead.&lt;br /&gt;&lt;br /&gt;People used to ask me to fix their computers. Now they ask me to calculate the tip and divide the bill when we go to restaurants, too.&lt;br /&gt;&lt;br /&gt;Yeah, so people don't know what mathematics is any better than they know what computer science is. &lt;br /&gt;&lt;br /&gt;Maths is not arithmetic (though arithmetic sometimes helps us do maths). Maths is not a set of facts you don't understand handed down from on high for you to remember. It's a world to explore and understand. To enjoy it, you'll want to explore yourself, but I'm going to show you some of the sights. Hopefully, a bit of high-school vocabulary and a bit of thought should be enough to understand this.&amp;nbsp;&lt;sup&gt;&lt;a name="body-source"&gt;&lt;a href="#foot-source"&gt;*&lt;/a&gt;&lt;/a&gt;&lt;/sup&gt;&lt;br /&gt;&lt;br /&gt;As one of my lecturers pointed out the other day, one of the reasons the natural numbers (whole, positive numbers) are interesting is because they have two kinds of structure: additive and multiplicative. The building block of the additive structure is one: we can make any number by taking one, adding one, adding one again, etc.&lt;br /&gt;&lt;br /&gt;But the multiplicative structure is a little more intricate. The building blocks are called "prime": the numbers you can't make by multiplying other numbers together. I'm sure you know them. 2, 3, 5, 7, 11, and so on.&lt;br /&gt;&lt;br /&gt;And so on? Does that mean I'm too lazy to list them all. Nope... there are infinitely many primes. How do I know? I have a proof.&lt;br /&gt;&lt;br /&gt;First off, what does it mean for there to be infinitely many primes? Clearly, it means for any prime, there is another one bigger than it. So how can we show that there is a prime bigger than &lt;var&gt;p&lt;/var&gt;?&lt;br /&gt;&lt;br /&gt;Take all the primes up to &lt;var&gt;p&lt;/var&gt;, multiply them together, and add one: 2&amp;times;3&amp;times;5&amp;times;...&lt;var&gt;p&lt;/var&gt;&amp;nbsp;+&amp;nbsp;1. This number isn't divisible by 2 (since the number is two times something plus 1, when you divide it by two you get a remainder of 1). Similarly, it isn't divisible by 3, 5, or any other prime up to &lt;var&gt;p&lt;/var&gt;.&lt;br /&gt;&lt;br /&gt;So either 2&amp;times;3&amp;times;5&amp;times;...&lt;var&gt;p&lt;/var&gt;&amp;nbsp;+&amp;nbsp;1 is prime, or there is some prime number bigger than &lt;var&gt;p&lt;/var&gt; which divides it.&lt;br /&gt;&lt;br /&gt;So &lt;var&gt;p&lt;/var&gt; is not the largest prime. But this argument works for any &lt;var&gt;p&lt;/var&gt;, so there is &lt;em&gt;no&lt;/em&gt; largest prime.&lt;br /&gt;&lt;br /&gt;This proof is due to Euclid. We proceeded from an obvious starting point, by obvious steps (if any of them were not obvious, leave a comment and I'll explain in further detail), to a non-obvious, interesting conclusion.&lt;br /&gt;&lt;br /&gt;I hope you think this is as beautiful as I do.&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name="foot-source"&gt;&lt;a href="#body-source"&gt;*&lt;/a&gt;&lt;/a&gt; The things I plan to present in this series are basically the subset of things that I've been thinking about and discussing with my friends which I can explain to my girlfriend, who is interested in maths but has never studied it beyond school.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-8851346040023677065?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/8851346040023677065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2008/03/mathematics-for-arithmeticians-prime.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/8851346040023677065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/8851346040023677065'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2008/03/mathematics-for-arithmeticians-prime.html' title='Mathematics for Arithmeticians: Prime Numbers'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-856479299080090992</id><published>2008-01-22T13:26:00.000+02:00</published><updated>2008-01-22T14:54:54.552+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unmonad'/><category scheme='http://www.blogger.com/atom/ns#' term='haskell'/><category scheme='http://www.blogger.com/atom/ns#' term='monad'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='IO'/><title type='text'>Unmonad Tutorial: IO in Haskell without understanding monads</title><content type='html'>Forget monads!&lt;br /&gt;&lt;br /&gt;These days, I hear a lot of "what kind of language makes you learn category theory to do IO" and "monads are a kludge to allow IO in a pure language."&lt;br /&gt;&lt;br /&gt;Both of these ideas are rubbish. You can do IO without understanding monads, and monads aren't a way of doing IO. The usual way to demonstrate this is to write yet another monad tutorial. But I'm bored of monad tutorials: half of them don't make sense, and anyway, I just want to do some frickin' IO.&lt;br /&gt;&lt;br /&gt;It's pretty simple. Haskell introduces a datatype for IO actions, and a DSL for creating them. The fact that &lt;code&gt;IO&lt;/code&gt; is an instance of the &lt;code&gt;Monad&lt;/code&gt; typeclass is irrelevant for our purposes. I just want to do some frickin' IO.&lt;br /&gt;&lt;br /&gt;The DSL is simple: &lt;strong&gt;&lt;code&gt;do&lt;/code&gt;&lt;/strong&gt; introduces an IO action. IO actions are formatted either as brace-enclosed, semicolon-delimited (like C) or indented, newline-delimited statements (like Python). Each statement is one of the following:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;let&lt;/strong&gt; &lt;var&gt;n&lt;/var&gt; = &lt;var&gt;v&lt;/var&gt;&lt;/code&gt; binds &lt;code&gt;&lt;var&gt;n&lt;/var&gt;&lt;/code&gt; to the value &lt;code&gt;&lt;var&gt;v&lt;/var&gt;&lt;/code&gt;.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;&lt;var&gt;n&lt;/var&gt; &lt;strong&gt;&amp;lt;-&lt;/strong&gt; &lt;var&gt;a&lt;/var&gt;&lt;/code&gt; executes the action &lt;code&gt;&lt;var&gt;a&lt;/var&gt;&lt;/code&gt; and binds the name &lt;code&gt;&lt;var&gt;n&lt;/var&gt;&lt;/code&gt; to the result.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;&lt;strong&gt;&lt;var&gt;a&lt;/var&gt;&lt;/strong&gt;&lt;/code&gt;, on its own, executes the action &lt;code&gt;&lt;var&gt;a&lt;/var&gt;&lt;/code&gt;.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;This is all rather similar to an imperative language, except that two types of assignment are distinguished.&lt;br /&gt;&lt;br /&gt;The result of running your newly constructed action is the result of the last action in your &lt;code&gt;do&lt;/code&gt; block. Which leaves just one more thing you'll need &lt;code&gt;return&lt;/code&gt;. This is not like the return of other languages: it's not a flow control statement. &lt;code&gt;return &lt;var&gt;x&lt;/var&gt;&lt;/code&gt; is an IO action that does nothing but yield &lt;code&gt;&lt;var&gt;x&lt;/var&gt;&lt;/code&gt; when executed.&lt;br /&gt;&lt;br /&gt;Notice that the &lt;code&gt;let &lt;var&gt;n&lt;/var&gt; = &lt;var&gt;v&lt;/var&gt;&lt;/code&gt; form is actually unneeded: it is equivalent to &lt;code&gt;&lt;var&gt;n&lt;/var&gt; &amp;lt;- return &lt;var&gt;v&lt;/var&gt;&lt;/code&gt;. So there's really only one type of assignment, if you prefer to look at it that way.&lt;br /&gt;&lt;br /&gt;You may be wondering how you pass arguments to an IO action. You don't. You make a function which takes arguments and returns an IO action.&lt;br /&gt;&lt;br /&gt;As a short example, I'll write a program that reads in some integers, and outputs a running total.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;totalLoop&lt;/code&gt; takes the old total, and produces an IO action which reads a line from standard input, converts it to an integer, prints the total, and then runs itself with the new total. It loops forever, so we give it the return type &lt;code&gt;()&lt;/code&gt;, the empty tuple, which is used like &lt;code&gt;void&lt;/code&gt; in Haskell.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; totalLoop :: Integer -&gt; IO ()&lt;br /&gt;&gt; totalLoop oldTotal =&lt;br /&gt;&gt;   do&lt;br /&gt;&gt;       input &lt;- getLine                    -- getLine :: IO String&lt;br /&gt;&gt;       let number = read input             -- read :: String -&gt; Integer&lt;br /&gt;&gt;       let newTotal = oldTotal + number&lt;br /&gt;&gt;       print newTotal                      -- print :: Integer -&gt; IO ()&lt;br /&gt;&gt;       totalLoop newTotal&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;main&lt;/code&gt; simply runs &lt;code&gt;totalLoop&lt;/code&gt; with a zero total.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; main :: IO ()&lt;br /&gt;&gt; main =&lt;br /&gt;&gt;   do&lt;br /&gt;&gt;       totalLoop 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And there you have it: an IO-performing (if uninteresting) Haskell program, without any understanding of what monads are.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-856479299080090992?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/856479299080090992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2008/01/unmonad-tutorial-io-in-haskell-for-non.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/856479299080090992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/856479299080090992'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2008/01/unmonad-tutorial-io-in-haskell-for-non.html' title='Unmonad Tutorial: IO in Haskell without understanding monads'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-6517476466763882133</id><published>2008-01-18T23:26:00.000+02:00</published><updated>2008-01-19T00:06:04.300+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='superghost'/><category scheme='http://www.blogger.com/atom/ns#' term='ghost'/><category scheme='http://www.blogger.com/atom/ns#' term='haskell'/><title type='text'>First player wins Superghost</title><content type='html'>Inspired by the XKCD's &lt;a href="http://blag.xkcd.com/2007/12/31/ghost/"&gt;blag post on the solution to Ghost&lt;/a&gt;, I first verified his results, and then moved onto the somewhat harder task of solving Ghost's wicked step-sister, Superghost.&lt;br /&gt;&lt;br /&gt;Briefly, the rules of Superghost: the first player names a letter; then, each player in turn either adds a letter to the beginning ("conses" a letter) or to the end ("snocs" a letter; the words "cons" and "snoc" are not game terminology, but functional-programming jargon). The first player to create a string of letters which is not part of a real word, or completes a real word, loses. I consider only the two-player version.&lt;br /&gt;&lt;br /&gt;The solver is written in Haskell, and uses the Ubuntu British English word list. Only words with four or more letters are considered. Words containing capital or accented letters are ignored.&lt;br /&gt;&lt;br /&gt;The program took about 22.5 seconds to find the solution: The first player wins, by playing &lt;em&gt;a, i, o, s,&lt;/em&gt; or &lt;em&gt;v&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;The winning responses for the second player:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;('a',[])&lt;br /&gt;('b',[Snoc 'w'])&lt;br /&gt;('c',[Cons 'g',Cons 'w',Snoc 'd',Snoc 'q'])&lt;br /&gt;('d',[Cons 'c',Cons 'f',Cons 'g',Snoc 'w'])&lt;br /&gt;('e',[Snoc 'r'])&lt;br /&gt;('f',[Cons 'f',Cons 'h',Cons 'l',Cons 'x',Snoc 'd',Snoc 'f',Snoc 'g',Snoc 'n',Snoc 'p',Snoc 'w'])&lt;br /&gt;('g',[Cons 'f',Cons 'h',Cons 'l',Cons 'x',Snoc 'c',Snoc 'd',Snoc 'j',Snoc 'm',Snoc 'w',Snoc 'z'])&lt;br /&gt;('h',[Cons 'm',Cons 'n',Cons 'x',Snoc 'f',Snoc 'g',Snoc 'k',Snoc 'q'])&lt;br /&gt;('i',[])&lt;br /&gt;('j',[Cons 'g',Cons 'k',Cons 'p',Cons 'r',Cons 'u'])&lt;br /&gt;('k',[Cons 'h',Cons 'k',Cons 't',Cons 'w',Cons 'y',Snoc 'j',Snoc 'k'])&lt;br /&gt;('l',[Cons 'w',Cons 'x',Snoc 'f',Snoc 'g'])&lt;br /&gt;('m',[Cons 'g',Snoc 'h'])&lt;br /&gt;('n',[Cons 'f',Cons 'x',Snoc 'h',Snoc 'w',Snoc 'x'])&lt;br /&gt;('o',[])&lt;br /&gt;('p',[Cons 'f',Snoc 'j'])&lt;br /&gt;('q',[Cons 'c',Cons 'h',Cons 'x'])&lt;br /&gt;('r',[Cons 'e',Cons 'r',Snoc 'j',Snoc 'r'])&lt;br /&gt;('s',[])&lt;br /&gt;('t',[Snoc 'k'])&lt;br /&gt;('u',[Snoc 'j'])&lt;br /&gt;('v',[])&lt;br /&gt;('w',[Cons 'b',Cons 'd',Cons 'f',Cons 'g',Cons 'n',Cons 'w',Snoc 'c',Snoc 'k',Snoc 'l',Snoc 'w',Snoc 'y'])&lt;br /&gt;('x',[Cons 'n',Snoc 'f',Snoc 'g',Snoc 'h',Snoc 'l',Snoc 'n',Snoc 'q'])&lt;br /&gt;('y',[Cons 'w',Snoc 'k'])&lt;br /&gt;('z',[Cons 'g'])&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Byorgey wanted code... he gets code. Sorry about the lack of comments, but this is a for-fun hack.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;module Main where&lt;br /&gt;&lt;br /&gt;import qualified Data.Set as S&lt;br /&gt;import qualified Data.Map as M&lt;br /&gt;import qualified Data.List as L&lt;br /&gt;import Data.Maybe (fromMaybe)&lt;br /&gt;import Control.Applicative&lt;br /&gt;&lt;br /&gt;type SuperghostDict = M.Map String (S.Set String)&lt;br /&gt;&lt;br /&gt;data Play = Cons Char | Snoc Char deriving (Show, Eq, Ord)&lt;br /&gt;&lt;br /&gt;getWords :: IO [String]&lt;br /&gt;getWords = filter (all (`elem` ['a'..'z'])) &lt;$&gt;&lt;br /&gt;            lines &lt;$&gt;&lt;br /&gt;            readFile "/usr/share/dict/words"&lt;br /&gt;&lt;br /&gt;makeDict :: [String] -&gt; SuperghostDict&lt;br /&gt;makeDict words = M.unionWith S.union&lt;br /&gt;                 (M.fromListWith S.union $&lt;br /&gt;                    concatMap (\word -&gt; let tails = L.tails word in&lt;br /&gt;                                        zip (tail tails) $ map S.singleton tails)&lt;br /&gt;                               words)&lt;br /&gt;                 (M.fromAscList $ map (\x -&gt; (x, S.empty)) $ words)&lt;br /&gt;&lt;br /&gt;wordsEnding :: String -&gt; SuperghostDict -&gt; S.Set String&lt;br /&gt;wordsEnding word dict = (fromMaybe S.empty $ M.lookup word dict)&lt;br /&gt;&lt;br /&gt;wordsStarting :: String -&gt; SuperghostDict -&gt; S.Set String&lt;br /&gt;wordsStarting word dict = S.fromAscList $&lt;br /&gt;                            (takeWhile (word `L.isPrefixOf`) $ map fst $&lt;br /&gt;                                                M.toAscList $ snd $ M.split word dict)&lt;br /&gt;&lt;br /&gt;wordsMiddling :: String -&gt; SuperghostDict -&gt; S.Set String&lt;br /&gt;wordsMiddling word dict = (foldr S.union S.empty&lt;br /&gt;                        (map snd $ takeWhile ((word `L.isPrefixOf`) . fst) $&lt;br /&gt;                                                M.toAscList $ snd $ M.split word dict))&lt;br /&gt;&lt;br /&gt;wordsWith :: String -&gt; SuperghostDict -&gt; S.Set String&lt;br /&gt;wordsWith word dict = (wordsEnding word dict) `S.union`&lt;br /&gt;                        (wordsStarting word dict) `S.union`&lt;br /&gt;                            (wordsMiddling word dict)&lt;br /&gt;&lt;br /&gt;plays :: String -&gt; SuperghostDict -&gt; S.Set Play&lt;br /&gt;plays word dict = (S.map (\ w -&gt; (Snoc $ w !! (length word))) $&lt;br /&gt;                        wordsStarting word dict)&lt;br /&gt;                    `S.union` (S.map (\ w -&gt; Cons $ head w)&lt;br /&gt;                                $ wordsEnding word dict)&lt;br /&gt;                        `S.union` (S.map (\ w -&gt; Cons $ head w)&lt;br /&gt;                                    $ wordsMiddling word dict)&lt;br /&gt;&lt;br /&gt;apply :: String -&gt; Play -&gt; String&lt;br /&gt;apply word (Snoc c) = word ++ [c]&lt;br /&gt;apply word (Cons c) = c:word&lt;br /&gt;&lt;br /&gt;winnable :: SuperghostDict -&gt; String -&gt; Bool&lt;br /&gt;winnable dict word = let moves = S.toList $ plays word dict in&lt;br /&gt;                        if null moves then&lt;br /&gt;                            True&lt;br /&gt;                        else&lt;br /&gt;                            any (not . (winnable dict) . (apply word)) moves&lt;br /&gt;&lt;br /&gt;winningPlays :: SuperghostDict -&gt; String -&gt; [Play]&lt;br /&gt;winningPlays dict word = let moves = S.toList $ plays word dict in&lt;br /&gt;                            filter (not . (winnable dict) . (apply word)) moves&lt;br /&gt;&lt;br /&gt;forever :: (Monad m) =&gt; m a -&gt; m ()&lt;br /&gt;forever x = x &gt;&gt; forever x&lt;br /&gt;&lt;br /&gt;main = do&lt;br /&gt;        dict &lt;- makeDict &lt;$&gt; filter ((&gt; 3) . length) &lt;$&gt; getWords&lt;br /&gt;        print $ winningPlays dict ""&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-6517476466763882133?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/6517476466763882133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2008/01/first-player-wins-superghost.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/6517476466763882133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/6517476466763882133'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2008/01/first-player-wins-superghost.html' title='First player wins Superghost'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-2908851518680206077</id><published>2007-10-24T15:06:00.000+02:00</published><updated>2007-10-24T15:33:29.752+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='turing'/><category scheme='http://www.blogger.com/atom/ns#' term='icfp'/><category scheme='http://www.blogger.com/atom/ns#' term='wolfram'/><category scheme='http://www.blogger.com/atom/ns#' term='dna'/><title type='text'>An update: results and research</title><content type='html'>I have seen the ICFP, and it is full of funky symbols. Yes, we won a prize; two of the twelve of us headed of to Freiburg-im-Breisgau; and we came second, beaten by Team Smartass of Google. Interestingly, of the four contestants in Freiburg to collect prizes, three were South African (myself and &lt;a href='http://marco-za.blogspot.com/2007/10/icfp-how-we-came-2nd.html'&gt;Marco&lt;/a&gt; from the United Coding Team, as well as Daniel Wright of Team Smartass).&lt;br /&gt;&lt;br /&gt;A few months ago I posted an translation of Wolfram's (2, 3) Turing Machine into Fuun DNA. What I called "an open problem of Wolfram" is now closed. Today &lt;a href='http://blog.wolfram.com/2007/10/the_prize_is_won_the_simplest.html'&gt;Wolfram announced&lt;/a&gt; that this machine has been proven universal by Alex Smith. Since there is known to be no (2, 2) UTM, Wolfram and Smith's machine is the smallest Universal Turing Machine.&lt;br /&gt;&lt;br /&gt;Somewhat related to Wolfram and Smith, but *very* related to programmable Fuun DNA: &lt;a href='http://www.springerlink.com/content/uxuc20mnurg4qjug/'&gt;programmable terrestial DNA&lt;/a&gt; &amp;mdash; Programmed Mutagenesis Is a Universal Model of Computation by Khodor and Gifford. Perhaps Endo isn't as alien as we thought?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-2908851518680206077?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/2908851518680206077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2007/10/update-results-and-research.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/2908851518680206077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/2908851518680206077'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2007/10/update-results-and-research.html' title='An update: results and research'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-7334226260321785956</id><published>2007-09-19T17:24:00.000+02:00</published><updated>2007-09-19T22:55:23.194+02:00</updated><title type='text'>Haskelling the SACO 1</title><content type='html'>&lt;span style="font-style:italic; font-size:small;"&gt;These blog entries is to record my early adventures in Haskell, to advertise the SACO, and show off the awesomeness of Literal Haskell (which means that this entire post can be pasted into a text file and compiled) by documenting my  solutions to programming contest problems.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I've finally decided to learn Haskell. For about the third time.&lt;br /&gt;&lt;br /&gt;But this time I'm actually doing it.&lt;br /&gt;&lt;br /&gt;Since we've just hosted another successful &lt;a href="http://olympiad.cs.uct.ac.za/old/"&gt;South African Computer Olympiad&lt;/a&gt;&lt;sup&gt;&lt;a name="fn-body-1" href="#fn-1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;, I decided to code some Haskell solutions. Looking through the problems, I decided on Living Dead Parrots: I didn't code a check solution before the contest, so it wouldn't be too boring, but it was easy enough that I would spend more time learning the language than figuring out the algorithm. Most importantly, it was an interactive problem&lt;sup&gt;&lt;a name="fn-body-2" href="#fn-2"&gt;[2]&lt;/a&gt;&lt;/sup&gt;, meaning I would be brought face-to-face with the IO monad, a fearful prospect for the novice Haskeller.&lt;br /&gt;&lt;br /&gt;Well, it wasn't as scary as I'd feared. By no means.&lt;br /&gt;&lt;br /&gt;In short, the problem we're solving is this: the evaluator has an array of &lt;var&gt;N&lt;/var&gt; booleans. You can ask it for the number of true values between two indices (inclusive, base one). Less than a hundredth of the booleans are true. There is a limit on the number of queries you can make, but we ignore it, since it is always larger than the number needed by the correct algorithm.&lt;br /&gt;&lt;br /&gt;This solution scores 100% (within the C++ time limit, when compiled with GHC), but is probably not the best Haskell ever written. I'd appreciate any advice you can give for improvements. That's why I'm posting, after all.&lt;br /&gt;&lt;br /&gt;First, the preliminaries:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; module Main&lt;br /&gt;&gt;     where&lt;br /&gt;&gt;&lt;br /&gt;&gt; import System.IO&lt;br /&gt;&gt;&lt;br /&gt;&gt; rInt :: String -&gt; Int&lt;br /&gt;&gt; rInt = read&lt;br /&gt;&gt;&lt;br /&gt;&gt; flush :: IO ()&lt;br /&gt;&gt; flush = hFlush stdout&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next, the function to query the evaluator. We output "Q &lt;var&gt;a&lt;/var&gt; &lt;var&gt;b&lt;/var&gt;", and read in an integer. The answer is obviously wrapped in the IO monad.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; query :: Int -&gt; Int -&gt; IO Int&lt;br /&gt;&gt; query a b = do putStrLn ("Q " ++ (show a) ++ " " ++ (show b))&lt;br /&gt;&gt;                flush&lt;br /&gt;&gt;                answer &lt;- getLine&lt;br /&gt;&gt;                return $ rInt answer&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'm not particularly proud of this function, which wraps a value in the IO monad. If it's the right thing to do, there's a library function for it; if it's the wrong thing to do, I shouldn't do it. If you know which it is, leave a comment.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; coerceIO :: a -&gt; IO a&lt;br /&gt;&gt; coerceIO x = do return x&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here comes the meaty part. Search takes a range, and the number of parrots (oh, yes, those booleans represent whether a parrot in a certain cage is pining for the fjords or has kicked the bucket) in that range, and determines where those parrots are.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; search :: Int -&gt; Int -&gt; Int -&gt; IO [Bool]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There are three cases. The first is that the range contains no parrots.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; search start end 0 = coerceIO $ take (end-start+1) (repeat False)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The next case is that the range contains only one element, then we have found the location of a living parrot.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; search start end 1          | start == end  = coerceIO [True]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The interesting case is the remaining one, where we divide the list into two, and recurse.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; search start end numParrots = let middle = (end+start) `div` 2&lt;br /&gt;&gt;                                in do leftNum &lt;- query start middle&lt;br /&gt;&gt;                                      left &lt;- search start middle leftNum&lt;br /&gt;&gt;                                      right &lt;- search (middle+1) end (numParrots-leftNum)&lt;br /&gt;&gt;                                      return (left ++ right)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;All that remains is &lt;code&gt;main&lt;/code&gt;, which contains my most suspicious use of &lt;code&gt;coerceIO&lt;/code&gt;, to bind purely functional variables in a monad: I haven't figured out how to use &lt;code&gt;let&lt;/code&gt; in a &lt;code&gt;do&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;It first reads a line containing two integers: the size of the parrot array, and the number of questions. We ignore the latter. We then find the number of live parrots in the array, and begin the search. The output format is "A 0 0 0 0 1 0 1 0 1 ...".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; main :: IO ()&lt;br /&gt;&gt; main = do line &lt;- getLine&lt;br /&gt;&gt;           n &lt;- coerceIO $ rInt $ head $ words line&lt;br /&gt;&gt;           numParrots &lt;- query 1 n&lt;br /&gt;&gt;           parrots &lt;- search 1 n numParrots&lt;br /&gt;&gt;           putStrLn $ "A " ++ (unwords $ map (\x -&gt; if x then "1" else "0") parrots)&lt;br /&gt;&gt;           return ()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Notes on Haskell syntax, for non-Haskellers: &lt;code&gt;f $ x&lt;/code&gt; is the same as &lt;code&gt;f x&lt;/code&gt;, except that it binds more loosely. Its purpose is mostly to eliminate lots of irritating superfluous parentheses. &lt;code&gt;(\x -&gt; y)&lt;/code&gt; is an anonymous function mapping &lt;code&gt;x&lt;/code&gt; to &lt;code&gt;y&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;&lt;sup&gt;&lt;a name="fn-1" href="#fn-body-1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;We now run a parallel contest online: same problems, but open to anyone. You should check it out this time next year. We might also be running the contests from the training camps online (training camps happen about three times a year, starting in February). Unfortunately, Haskell is not one of the supported languages, but after the contests you can download the evaluator programs and test data to score solutions in any language.&lt;br /&gt;&lt;br /&gt;&lt;sup&gt;&lt;a name="fn-1" href="#fn-body-1"&gt;[2]&lt;/a&gt;&lt;/sup&gt;In the SACO, interactive problem solutions communicate through pipes with an evaluator, rather than reading an input file and writing an output file. This allows problems where access to the full dataset is unnecessary, and is either not allowed or too big to be read completely within the time limit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-7334226260321785956?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/7334226260321785956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2007/09/haskelling-saco-1.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/7334226260321785956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/7334226260321785956'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2007/09/haskelling-saco-1.html' title='Haskelling the SACO 1'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-2608887692877610826</id><published>2007-08-29T21:31:00.000+02:00</published><updated>2007-08-30T01:17:53.784+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='endo'/><category scheme='http://www.blogger.com/atom/ns#' term='turing'/><category scheme='http://www.blogger.com/atom/ns#' term='fuun'/><category scheme='http://www.blogger.com/atom/ns#' term='compiler'/><title type='text'>Mr Turing, meet Endo</title><content type='html'>From the moment we saw what Endo's DNA was doing as we ran it, every ICFP contestant (at least, those who got that far) knew in their hearts that Fuun DNA is Turing complete. But I am a mathematician! And mathematicians need proof.&lt;br /&gt;&lt;br /&gt;Mr Turing, I'd like you to meet Endo:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;IIPIFFPCPPPIICIIPIFFPCPPFIICIIPIFFPCPPPIICIICIFPIC&lt;br /&gt;PIFPCPIFPICPIICFIFFFFIFCIPPFIFCCCIFIFCPFIFCFFIFIFC&lt;br /&gt;PCIFIFCPFIFFIFIFFCIIPIFFPCPFCIICICICPCPFFPCPCPFICP&lt;br /&gt;CPFPPCPPCIICIFPPICPPCPFFFFPCPFICPCPFPPCPPCFICPCPFI&lt;br /&gt;CIICIIPIFFPCPFCIICICICPCPFFPCPCPFICPCPFPIIPIFFPCPF&lt;br /&gt;ICIICIIPIFFPCPPCIICIICIFPPICPPCPFFIFPCPPCPFPIFPICP&lt;br /&gt;FICPCPFICIICIIPIFFPCPFCIICICICPCPFFFICPCPFICPCPFPI&lt;br /&gt;IPIFFPCPPCIICPCPPFIICIFPPICPPCPFFFCPCPFICPCPFPPCPC&lt;br /&gt;PFICIFPCPPCPPFIICIIPIFFPCPFCIICICICPCPFFFICPCPFICP&lt;br /&gt;CPFPIIPIFFPCPPCIICIIPIFFPCPFICIICIICIFPPICPPCPFFIF&lt;br /&gt;PICPPCPFPPCPCPFICIFPCPIICIIPIFFPCPFCIICICICPCPFFFP&lt;br /&gt;PCPFICPCPFPIIPIFFPCPPCIICPCPPFIICIFPPICICPCPFFFCPC&lt;br /&gt;PFICPCPFPFCPCPFICIFPCPPCPPFIICIIPIFFPCPFCIICICICPC&lt;br /&gt;PFFFPPCPFICPCPFPIIPIFFPCPPCIICIIPIFFPCPFICIICIICIF&lt;br /&gt;PPICICPCPFFIFPICPPCPFPFCPCPFICIFPCPIICIIPIFFPCPFCI&lt;br /&gt;ICICICPCPFFFFPCPFICPCPFPIIPIFFPCPPCIICPCPPFIICIFPP&lt;br /&gt;ICICPCPFFFCPCPFICPCPFPFCPCPFICIFPCPPCPPFIICIIPIFFP&lt;br /&gt;CPFCIICICICPCPFFFFPCPFICPCPFPIIPIFFPCPPCIICIIPIFFP&lt;br /&gt;CPFICIICIICIFPPICICPCPFFIFPICPPCPFPFCPCPFICIFPCPII&lt;br /&gt;CIIPIFFPCPFCIICICICPCPFFFCPCPFICPCPFPPCPPCIICIFPPI&lt;br /&gt;CICPCPFFFFPCPFICPCPFPPCPPCFFPCPFICIICIIPIFFPCPFCII&lt;br /&gt;CICICPCPFFFCPCPFICPCPFPIIPIFFPCPFICIICIIPIFFPCPPCI&lt;br /&gt;ICIICIFPPICICPCPFFIFPCPPCPFPIFPICPFFPCPFICIICIIPIF&lt;br /&gt;FPCPFCIICICPPCPFFPCPCPFICPCPFPPCPPCIICIFPPICPPCPFF&lt;br /&gt;FFPCPFICPCPFPPCPPCFPPCPFICIICIIPIFFPCPFCIICICPPCPF&lt;br /&gt;FPCPCPFICPCPFPIIPIFFPCPFICIICIIPIFFPCPPCIICIICIFPP&lt;br /&gt;ICPPCPFFIFPCPPCPFPIFPICPFPPCPFICIICIIPIFFPCPFCIICI&lt;br /&gt;CPPCPFFFICPCPFICPCPFPIIPIFFPCPPCIICPCPPFIICIFPPICP&lt;br /&gt;PCPFFFCPCPFICPCPFPPCPCPFICIFPCPPCPPFIICIIPIFFPCPFC&lt;br /&gt;IICICPPCPFFFICPCPFICPCPFPIIPIFFPCPPCIICIIPIFFPCPFI&lt;br /&gt;CIICIICIFPPICPPCPFFIFPICPPCPFPPCPCPFICIFPCPIICIIPI&lt;br /&gt;FFPCPFCIICICPPCPFFFPPCPFICPCPFPIIPIFFPCPPCIICPCPPF&lt;br /&gt;IICIFPPICICPCPFFFCPCPFICPCPFPPCPCPFICIFPCPPCPPFIIC&lt;br /&gt;IIPIFFPCPFCIICICPPCPFFFPPCPFICPCPFPIIPIFFPCPPCIICI&lt;br /&gt;IPIFFPCPFICIICIICIFPPICICPCPFFIFPICPPCPFPPCPCPFICI&lt;br /&gt;FPCPIICIIPIFFPCPFCIICICPPCPFFFFPCPFICPCPFPIIPIFFPC&lt;br /&gt;PPCIICPCPPFIICIFPPICICPCPFFFCPCPFICPCPFPFCPCPFICIF&lt;br /&gt;PCPPCPPFIICIIPIFFPCPFCIICICPPCPFFFFPCPFICPCPFPIIPI&lt;br /&gt;FFPCPPCIICIIPIFFPCPFICIICIICIFPPICICPCPFFIFPICPPCP&lt;br /&gt;FPFCPCPFICIFPCPIICIIPIFFPCPFCIICICPPCPFFFCPCPFICPC&lt;br /&gt;PFPPCPPCIICIFPPICICPCPFFFFPCPFICPCPFPPCPPCFICPCPFI&lt;br /&gt;CIICIIPIFFPCPFCIICICPPCPFFFCPCPFICPCPFPIIPIFFPCPFI&lt;br /&gt;CIICIIPIFFPCPPCIICIICIFPPICICPCPFFIFPCPPCPFPIFPICP&lt;br /&gt;FICPCPFICIICIIPIFFPCPPPIICIIPIFFPCPPFIICIIPIFFPCPP&lt;br /&gt;PIICIICIFPICPIFPCPIFPICPIICFIFFF&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'm sure my (three, I think) regular readers have long ago worked out what I had up my sleeve, but this is it. Credit is due more to Cook and Wolfram than myself, and of course Endo and Turing, most of all.&lt;br /&gt;&lt;br /&gt;I realise that Jeuring, et al. have probably had a proof of this fact for several months, but I believe I am the first to make it public.&lt;br /&gt;&lt;br /&gt;To see this in action, configure your "build" program to output the current DNA at each iteration. The actual Turing machine data looks like this (it is surrounded front and back by the mechanics of the maching):&lt;br /&gt;&lt;br /&gt;"PPPCI $State PPPCC $Symbol PPPCP PPPCF $LeftStack PPPFI $RightStack PPPFC"&lt;br /&gt;&lt;br /&gt;$State is either "PP" (up) or "PF" (down). $Symbol is the symbol currently "under the head"; the symbols are "CI", "CC", "CF", "CP" and "FI", from white to black (note that I read NKS online, so I don't know what the colours are in the original). $LeftStack and $RightStack are lists of symbols delimited by "PPPCP", both starting with the tape cell nearest the head.&lt;br /&gt;&lt;br /&gt;My previous Turing machines had a similar structure, but used "markers" other than "PPPxx".&lt;br /&gt;&lt;br /&gt;EDIT: I have changed "FIFxx" for the markers, since strings of P's behave particularly badly in the face of quoting.&lt;br /&gt;&lt;br /&gt;I'll leave the rest to you to work out.&lt;br /&gt;&lt;br /&gt;Now... can we write a compiler before the organisers release theirs? I'm in the middle of a whole bunch of projects and tests, as well as practising for ACM ICPC, but I'd love to contribute if somebody else is prepared to lead for a bit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-2608887692877610826?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/2608887692877610826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2007/08/mr-turing-meet-endo.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/2608887692877610826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/2608887692877610826'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2007/08/mr-turing-meet-endo.html' title='Mr Turing, meet Endo'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-4626119484139273710</id><published>2007-08-26T22:47:00.000+02:00</published><updated>2007-08-26T23:42:03.829+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fuun'/><category scheme='http://www.blogger.com/atom/ns#' term='universality'/><category scheme='http://www.blogger.com/atom/ns#' term='wolfram'/><title type='text'>On an open problem of Wolfram</title><content type='html'>I have something to admit. Something rather shameful. &lt;em&gt;I never learnt Fuun during the contest.&lt;/em&gt; After all, I was a late arrival to a team with a man we call Bruce Almighty, after whom the Bruce-First Search is named. Although I had a vague understanding of the low-level details, my contributions were mostly at a higher level.&lt;br /&gt;&lt;br /&gt;So I'm only really learning the details now, as I don my tin-foil hat and prepare for a Fuun-filled future. When I saw Jochen's ingenious 55-character junk generator, I had only an inkling of how it worked until I whipped out my spec booklet and a pencil. Jochen's string shows just how incredibly rich Fuun DNA is. And also that Jochen is a brilliant DNA hacker.&lt;br /&gt;&lt;br /&gt;I will now, finally, progress to my point. Last week, I left you with an SHA-1 "essence" of a result. In truth, it is more of a question than a result. It is suspected by some that the following DNA sequence has a truly awe-inspiring property: that the genetic program of any being can be emulated by this sequence of Fuun genes. Is this the case? A cash prize is offered for a proof of the affirmative.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;IIPIFFCFPPPIICIIPIFFCFPPFIICIIPIFFCFPPPIICIICIFPIC&lt;br /&gt;PIFPCPIFPICPIICICFFFICFCIPFICFCCCCICFCPICFCFICFFII&lt;br /&gt;CFFCIIPIFFCFPFCIICICPCFPFFFPCFPFICCFPFPCFPPCIICIFP&lt;br /&gt;PICPCFPFFFFCFPFICCFPFPCFPPCFCCFPFICIICIIPIFFCFPFCI&lt;br /&gt;ICICPCFPFFFPCFPFICCFPFPIIPIFFCFPFICIICIIPIFFCFPPCI&lt;br /&gt;ICIICIFPPICPCFPFFIFPCPCFPFPIFPICPFCCFPFICIICIIPIFF&lt;br /&gt;CFPFCIICICPCFPFFFCCFPFICCFPFPCFPPCIICIFPPICPCFPFFF&lt;br /&gt;FCFPFICCFPFPCFPPCFPCFPFICIICIIPIFFCFPFCIICICPCFPFF&lt;br /&gt;FCCFPFICCFPFPIIPIFFCFPFICIICIIPIFFCFPPCIICIICIFPPI&lt;br /&gt;CPCFPFFIFPCPCFPFPIFPICPFPCFPFICIICIIPIFFCFPFCIICIC&lt;br /&gt;PCFPFFFFCFPFICCFPFPIIPIFFCFPPCIICCFPPFIICIFPPICICC&lt;br /&gt;FPFFFFCFPFICCFPFPFCCFPFICIFPCPCFPPFIICIIPIFFCFPFCI&lt;br /&gt;ICICPCFPFFFFCFPFICCFPFPIIPIFFCFPPCIICIIPIFFCFPFICI&lt;br /&gt;ICIICIFPPICICCFPFFIFPICPCFPFPFCCFPFICIFPCPIICIIPIF&lt;br /&gt;FCFPFCIICICICCFPFFFPCFPFICCFPFPIIPIFFCFPPCIICCFPPF&lt;br /&gt;IICIFPPICPCFPFFFFCFPFICCFPFPFFCFPFICIFPCPCFPPFIICI&lt;br /&gt;IPIFFCFPFCIICICICCFPFFFPCFPFICCFPFPIIPIFFCFPPCIICI&lt;br /&gt;IPIFFCFPFICIICIICIFPPICPCFPFFIFPICPCFPFPFFCFPFICIF&lt;br /&gt;PCPIICIIPIFFCFPFCIICICICCFPFFFCCFPFICCFPFPIIPIFFCF&lt;br /&gt;PPCIICCFPPFIICIFPPICICCFPFFFFCFPFICCFPFPFPCFPFICIF&lt;br /&gt;PCPCFPPFIICIIPIFFCFPFCIICICICCFPFFFCCFPFICCFPFPIIP&lt;br /&gt;IFFCFPPCIICIIPIFFCFPFICIICIICIFPPICICCFPFFIFPICPCF&lt;br /&gt;PFPFPCFPFICIFPCPIICIIPIFFCFPFCIICICICCFPFFFFCFPFIC&lt;br /&gt;CFPFPCFPPCIICIFPPICPCFPFFFFCFPFICCFPFPCFPPCFPCFPFI&lt;br /&gt;CIICIIPIFFCFPFCIICICICCFPFFFFCFPFICCFPFPIIPIFFCFPF&lt;br /&gt;ICIICIIPIFFCFPPCIICIICIFPPICPCFPFFIFPCPCFPFPIFPICP&lt;br /&gt;FPCFPFICIICIIPIFFCFPPPIICIIPIFFCFPPFIICIIPIFFCFPPP&lt;br /&gt;IICIICIFPICPIFPCPIFPICPIICICFFF&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-4626119484139273710?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/4626119484139273710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2007/08/on-open-problem-of-wolfram.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/4626119484139273710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/4626119484139273710'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2007/08/on-open-problem-of-wolfram.html' title='On an open problem of Wolfram'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3826164796564330590.post-1062952058842026370</id><published>2007-08-23T16:51:00.000+02:00</published><updated>2007-08-24T22:59:05.343+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fuun'/><category scheme='http://www.blogger.com/atom/ns#' term='icfp'/><category scheme='http://www.blogger.com/atom/ns#' term='junk dna'/><category scheme='http://www.blogger.com/atom/ns#' term='fuun defense'/><title type='text'>Investigating Endo: Junk DNA</title><content type='html'>My friend Marco has &lt;a href="http://marco-za.blogspot.com/search/label/icfp"&gt;blogged&lt;/a&gt; about my team's experience in the ICFP, but since the contest, I've been investigating Endo's DNA. &lt;a href="http://johanjeuring.blogspot.com/"&gt;Johann Jeuring&lt;/a&gt; is slowly revealing some interesting facts, but as we know, he was kidnapped by Fuun invaders, and so we can't really trust what he tells us.&lt;br /&gt;&lt;br /&gt;I've discovered some truly remarkable properties of Fuun DNA, the proof of which this blog is wide enough to contain. Unfortunately Earth's internet has already been infiltrated by Fuun agents, as attested by their subversion of the ICFP itself.&lt;br /&gt;&lt;br /&gt;I will, however, reveal a single DNA sequence, which may prove useful in the defense against Fuun invaders, should they further threaten our planet. When "executed" it generates large amounts of "&lt;a href="http://en.wikipedia.org/wiki/Junk_DNA"&gt;junk DNA&lt;/a&gt;". JB and HM indicate that in generates on the order of 10&lt;sup&gt;865&lt;/sup&gt; acids in about 10&lt;sup&gt;1730&lt;/sup&gt; iterations before destroying itself, but of course our gene simulators would take many years to confirm this.&lt;br /&gt;&lt;br /&gt;Anyone who discovers more about this sequence or others related to it should post them on this blog, so that we may broaden our knowledge of our universe's lifeforms, and begin to coordinate anti-Fuun defense, should it be necessary.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;IIPIFFCFPPPIICIIPIFFCFPPFIICIIPIFFCFPPPIICIICIFPIC&lt;br /&gt;PIFPCPIFPICPIICICFFFICFCIP&lt;b&gt;I&lt;/b&gt;ICFCCCCICFCPICFCFICFFII&lt;br /&gt;CFFCIIPIFFCFPFCIICICCCFPFFFFCFPFICCFPFPIIPIFFCFPPC&lt;br /&gt;IICCFPPFIICIFPPICFCFPFFFFCFPFICCFPFPFCCFPFICIFPCPC&lt;br /&gt;FPPFIICIIPIFFCFPFCIICICCCFPFFFFCFPFICCFPFPIIPIFFCF&lt;br /&gt;PPCIICIIPIFFCFPFICIICIICIFPPICFCFPFFIFPICPCFPFPFCC&lt;br /&gt;FPFICIFPCPIICIIPIFFCFPFCIICICCCFPFFFCCFPFICCFPFPCF&lt;br /&gt;PPCIICIFPPPFCFPFFFFCFPFICCFPFPCFPPCFFCFPFICIICIIPI&lt;br /&gt;FFCFPFCIICICCCFPFFFCCFPFICCFPFPIIPIFFCFPFICIICIIPI&lt;br /&gt;FFCFPPCIICIICIFPPPFCFPFFIFPCPCFPFPIFPICPFFCFPFICII&lt;br /&gt;CIIPIFFCFPFCIICICFCFPFFFFCFPFICCFPFPIIPIFFCFPPCIIC&lt;br /&gt;CFPPFIICIFPPICPCFPFFFFCFPFICCFPFPFFCFPFICIFPCPCFPP&lt;br /&gt;FIICIIPIFFCFPFCIICICFCFPFFFFCFPFICCFPFPIIPIFFCFPPC&lt;br /&gt;IICIIPIFFCFPFICIICIICIFPPICPCFPFFIFPICPCFPFPFFCFPF&lt;br /&gt;ICIFPCPIICIIPIFFCFPFCIICICFCFPFFFCCFPFICCFPFPIIPIF&lt;br /&gt;FCFPPCIICCFPPFIICIFPPICICCFPFFFFCFPFICCFPFPFFCFPFI&lt;br /&gt;CIFPCPCFPPFIICIIPIFFCFPFCIICICFCFPFFFCCFPFICCFPFPI&lt;br /&gt;IPIFFCFPPCIICIIPIFFCFPFICIICIICIFPPICICCFPFFIFPICP&lt;br /&gt;CFPFPFFCFPFICIFPCPIICIIPIFFCFPFCIICICPCFPFFFFCFPFI&lt;br /&gt;CCFPFPCFPPCIICIFPPICICCFPFFFFCFPFICCFPFPCFPPCFCCFP&lt;br /&gt;FICIICIIPIFFCFPFCIICICPCFPFFFFCFPFICCFPFPIIPIFFCFP&lt;br /&gt;FICIICIIPIFFCFPPCIICIICIFPPICICCFPFFIFPCPCFPFPIFPI&lt;br /&gt;CPFCCFPFICIICIIPIFFCFPFCIICICPCFPFFFCCFPFICCFPFPII&lt;br /&gt;PIFFCFPPCIICCFPPFIICIFPPPCCFPFFFFCFPFICCFPFPFCCFPF&lt;br /&gt;ICIFPCPCFPPFIICIIPIFFCFPFCIICICPCFPFFFCCFPFICCFPFP&lt;br /&gt;IIPIFFCFPPCIICIIPIFFCFPFICIICIICIFPPPCCFPFFIFPICPC&lt;br /&gt;FPFPFCCFPFICIFPCPIICIIPIFFCFPFCIICICICCFPFFFFCFPFI&lt;br /&gt;CCFPFPCFPPCIICIFPPPCCFPFFFFCFPFICCFPFPCFPPCFFCFPFI&lt;br /&gt;CIICIIPIFFCFPFCIICICICCFPFFFFCFPFICCFPFPIIPIFFCFPF&lt;br /&gt;ICIICIIPIFFCFPPCIICIICIFPPPCCFPFFIFPCPCFPFPIFPICPF&lt;br /&gt;FCFPFICIICIIPIFFCFPFCIICICICCFPFFFCCFPFICCFPFPCFPP&lt;br /&gt;CIICIFPPICICCFPFFFFCFPFICCFPFPCFPPCFFCFPFICIICIIPI&lt;br /&gt;FFCFPFCIICICICCFPFFFCCFPFICCFPFPIIPIFFCFPFICIICIIP&lt;br /&gt;IFFCFPPCIICIICIFPPICICCFPFFIFPCPCFPFPIFPICPFFCFPFI&lt;br /&gt;CIICIIPIFFCFPFCIICPCCFPFFFFCFPFICCFPFPIIPIFFCFPPCI&lt;br /&gt;ICCFPPFIICIFPPICCCFPFFFFCFPFICCFPFPFFCFPFICIFPCPCF&lt;br /&gt;PPFIICIIPIFFCFPFCIICPCCFPFFFFCFPFICCFPFPIIPIFFCFPP&lt;br /&gt;CIICIIPIFFCFPFICIICIICIFPPICCCFPFFIFPICPCFPFPFFCFP&lt;br /&gt;FICIFPCPIICIIPIFFCFPFCIICPCCFPFFFCCFPFICCFPFPIIPIF&lt;br /&gt;FCFPPCIICCFPPFIICIFPPICPCFPFFFFCFPFICCFPFPFCCFPFIC&lt;br /&gt;IFPCPCFPPFIICIIPIFFCFPFCIICPCCFPFFFCCFPFICCFPFPIIP&lt;br /&gt;IFFCFPPCIICIIPIFFCFPFICIICIICIFPPICPCFPFFIFPICPCFP&lt;br /&gt;FPFCCFPFICIFPCPIICIIPIFFCFPFCIICPFCFPFFFFCFPFICCFP&lt;br /&gt;FPCFPPCIICIFPPICCCFPFFFFCFPFICCFPFPCFPPCFCCFPFICII&lt;br /&gt;CIIPIFFCFPFCIICPFCFPFFFFCFPFICCFPFPIIPIFFCFPFICIIC&lt;br /&gt;IIPIFFCFPPCIICIICIFPPICCCFPFFIFPCPCFPFPIFPICPFCCFP&lt;br /&gt;FICIICIFFCFPFCPFCFPFFFCCFPFICIFFCFPPPIICIICIIPIFFC&lt;br /&gt;FPPPIICIIPIFFCFPPFIICIIPIFFCFPPPIICIICIFPICPIFPCPI&lt;br /&gt;FPICPIICICFFF&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As a token, I leave you with this essence of my deepest result yet: 54c763a5f6b9beba26eeae2e98ba786f45b0fef8.&lt;br /&gt;&lt;br /&gt;EDIT: Thanks to Jochen for the correction. In case you were worrying, he is not a Fuun agent: I have carefully checked his patch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3826164796564330590-1062952058842026370?l=squing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://squing.blogspot.com/feeds/1062952058842026370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://squing.blogspot.com/2007/08/junk-dna.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/1062952058842026370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3826164796564330590/posts/default/1062952058842026370'/><link rel='alternate' type='text/html' href='http://squing.blogspot.com/2007/08/junk-dna.html' title='Investigating Endo: Junk DNA'/><author><name>Quiz</name><uri>http://www.blogger.com/profile/01935712406320139010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry></feed>
