<?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-5888658295182480819</id><updated>2012-01-15T15:35:36.574-03:00</updated><category term='C#'/><category term='Haskell'/><category term='Numeric'/><category term='Maths'/><category term='Graphics'/><category term='Networking'/><category term='Benchmark'/><category term='Mac OS X'/><category term='Logic'/><category term='OCaml'/><category term='Fiction'/><category term='Java'/><category term='Algorithms'/><category term='Translation'/><category term='Programming'/><category term='Oleg'/><category term='Types'/><category term='Meta'/><title type='text'>Alaska Ataca a Kamtchatka</title><subtitle type='html'>Under the spell of Dijkstra's dream</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default?start-index=101&amp;max-results=100'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>146</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-842675756657510379</id><published>2012-01-12T14:37:00.000-03:00</published><updated>2012-01-12T14:37:31.253-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>File Sharing on the Spot</title><summary type='text'>Last time I complained that I couldn't find an easy way to share a source code archive that didn't involve signing up for a service I didn't care for. Blogging platforms only make easy to attach images to posts, so why not pack a file as a PNG? Enter PNGPack. I tried finding OCaml bindings to libpng; after a disheartening exploration I realized that Java is (for me at least) the ideal platform to</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/842675756657510379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=842675756657510379' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/842675756657510379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/842675756657510379'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2012/01/file-sharing-on-spot.html' title='File Sharing on the Spot'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7433327196996534019</id><published>2012-01-11T10:02:00.001-03:00</published><updated>2012-01-12T14:40:36.965-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Benchmark'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Eighteen Million Noises</title><summary type='text'>Update: Here is the PNGPack source-code archive:
Per second. Yes, it's benchmark time. I pitted Prof. Perlin's original implementation against Stefan Gustavson's, and the results are in! I ran two sets of benchmarks, one in Java and the other in OCaml. In both cases I compared three versions of Simplex Noise: Perlin's pipelined 3D Noise, and Gustavson's 2D Noise and 3D Noise:
noisep: Perlin's 3D </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7433327196996534019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7433327196996534019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7433327196996534019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7433327196996534019'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2012/01/eighteen-million-noises.html' title='Eighteen Million Noises'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-_jkIeBdxFl4/Tw8a0gbM0aI/AAAAAAAAASc/0yOcfsLJ_M8/s72-c/noise.tgz.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1100518352992707768</id><published>2012-01-09T11:22:00.000-03:00</published><updated>2012-01-09T11:55:50.913-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Putting Noise to the Test</title><summary type='text'>So how do you use Perlin's Simplex Noise? By using the GIF encoder, of course! I generated the test image shown in the last post:

with a minimal application of both modules in test.ml (source code follows). For a visually richer but not much more complicated example, I also tried replicating Iñigo Quílez's turbulent textures in fbm.ml. The animation traces a tiny loop in noise space so that it </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1100518352992707768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1100518352992707768' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1100518352992707768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1100518352992707768'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2012/01/putting-noise-to-test.html' title='Putting Noise to the Test'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-rrUMJ9YXjnk/TwcgdENPhHI/AAAAAAAAARI/CTYlQboEBNM/s72-c/perlin.gif' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3943032083844750237</id><published>2012-01-06T13:39:00.000-03:00</published><updated>2012-01-06T13:39:26.680-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Perlin's Simplex Noise</title><summary type='text'>Graphics pioneer Ken Perlin is well-known for his work on procedural generation of textures. Recently he rewrote his classic Noise algorithm to reduce the complexity of generating pseudorandom gradients in higher dimensions by transforming a problem on N-cells to one on N-simplices. I couldn't find on his NYU home page a write-up by his own hand; apparently the only implementation exists in his </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3943032083844750237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3943032083844750237' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3943032083844750237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3943032083844750237'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2012/01/perlins-simplex-noise.html' title='Perlin&apos;s Simplex Noise'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-gXpVR4Hw4To/TwcgQ7nguxI/AAAAAAAAAQ8/_h5VGb2YKN4/s72-c/basisvec.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2353232766256502350</id><published>2011-12-30T15:50:00.000-03:00</published><updated>2011-12-30T15:50:32.002-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>(One by) Four by Nine</title><summary type='text'>
The four nines puzzle asks which positive numbers can be obtained from arithmetic expressions involving four "9" digits and an assortment of operations, minimally "+", "-" (binary and unary), "×" and "/", also frequently "√" and sometimes "!" (factorial). I'll show how to find them by brute force. In this case, I'll forgo using factorials; this means that not every number under 100 can be so </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2353232766256502350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2353232766256502350' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2353232766256502350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2353232766256502350'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/12/one-by-four-by-nine.html' title='(One by) Four by Nine'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4629996255890833816</id><published>2011-12-29T14:12:00.002-03:00</published><updated>2011-12-29T14:15:24.965-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Vose's Alias Method</title><summary type='text'>This is a note regarding the implementation of Vose's Method to construct the alias tables for non-uniform discrete probability sampling presented by Keith Schwartz (as of 2011-12-29). Mr. Schwartz otherwise very informative write-up contains an error in the presentation of the Method. Step 5 of the algorithm fails if the Small list is nonempty but the Large list is. This can happen either:
if </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4629996255890833816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4629996255890833816' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4629996255890833816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4629996255890833816'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/12/voses-alias-method.html' title='Vose&apos;s Alias Method'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3868932093240896985</id><published>2011-12-21T11:53:00.000-03:00</published><updated>2011-12-21T11:53:54.270-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Numeric'/><title type='text'>A Better (Gauss) Error Function</title><summary type='text'>If you do statistics you know of erf and erfc; if you work in OCaml you surely miss them. It is not very difficult to port the canonical implementation given by Numerical Recipes (which I won't show and not just for licensing reasons); if you Google for a coefficient you'll see that this approximation is, indeed, ubiquitous. There exists a better approximation in the literature, one that is more </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3868932093240896985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3868932093240896985' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3868932093240896985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3868932093240896985'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/12/better-gauss-error-function.html' title='A Better (Gauss) Error Function'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1432110959895951746</id><published>2011-11-17T18:45:00.001-03:00</published><updated>2011-11-17T18:57:05.098-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><title type='text'>Brainfuck in Java</title><summary type='text'>(I don't feel like writing a punning title.) Last time I showed how the use of functors allows for modular and type-safe specification of semantics. I wrote I can't imagine this flexibility in object-oriented languages like Java or Python; fighting words for which I was justly taken to task. Here's my penance: a morally equivalent reimplementation in Java of the Brainfuck interpreter. The </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1432110959895951746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1432110959895951746' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1432110959895951746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1432110959895951746'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/11/brainfuck-in-java.html' title='Brainfuck in Java'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-975138861590369536</id><published>2011-11-11T11:05:00.001-03:00</published><updated>2011-11-12T17:47:53.631-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Modular Semantics for Brainfuck</title><summary type='text'>The problem with Brainfuck is that its semantics are given by its different implementations but not all its implementations agree so that writing an interpreter is straightforward but writing portable Brainfuck programs is not. OCaml functors allows playing with pluggable semantics in a way that would be very difficult laborious with other languages. I can't imagine this flexibility in </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/975138861590369536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=975138861590369536' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/975138861590369536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/975138861590369536'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/11/modular-semantics-for-brainfuck.html' title='Modular Semantics for Brainfuck'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1123380397586601884</id><published>2011-10-28T16:58:00.001-03:00</published><updated>2012-01-06T13:43:05.173-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>A First-Principles GIF Encoder</title><summary type='text'>Also, quasicrystals. Have you ever found yourself wanting to do generated animations but didn't know how to visualize them? Since I couldn't find a self-contained GIF encoder, I made myself one. Even though it is not fast, I think its 220 lines are clear enough to be a good reference implementation to build upon. The encoder conforms to the following interface:
type palette
val palette : ?</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1123380397586601884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1123380397586601884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1123380397586601884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1123380397586601884'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/10/first-principles-gif-encoder.html' title='A First-Principles GIF Encoder'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-T0tvKxVPtBA/TqsJCUxziaI/AAAAAAAAAQk/JvmSxw0GNac/s72-c/quasicrystal.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-659080956398104925</id><published>2011-09-26T14:49:00.000-03:00</published><updated>2011-09-28T17:33:28.884-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Oleg'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Yield, Continue</title><summary type='text'>Roshan P. James and Amr Sabry show in "Yield: Mainstream Delimited Continuations" the interdefinability of yield-style generators and delimited continuations. Their encoding is at the same time simple and general, and even if the examples given in the paper are in Haskell, their translation into OCaml is straightforward. So much so that the result is essentially equivalent to ASAI Kenichi's </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/659080956398104925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=659080956398104925' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/659080956398104925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/659080956398104925'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/09/yield-continue.html' title='Yield, Continue'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-3snOkWzlo3E/ToC4Ub6EW-I/AAAAAAAAAQU/R175KvuqYts/s72-c/yield.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1365491068422015100</id><published>2011-09-16T15:59:00.002-03:00</published><updated>2011-09-16T15:59:38.383-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Oleg'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Higher Order Fun</title><summary type='text'>(the serious title of this post is "First-Class Modules Encode Type-Safe Reification of Types" or some such) After reading Kiselyov and Yallop's "First-class modules: hidden power and tantalizing promises", I wanted to understand how first-class modules relate to higher order types. They state that [f]irst-class modules — first-class functors — permit type constructor abstraction and polymorphism</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1365491068422015100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1365491068422015100' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1365491068422015100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1365491068422015100'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/09/higher-order-fun.html' title='Higher Order Fun'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8230421339121854064</id><published>2011-09-10T12:01:00.002-03:00</published><updated>2011-09-10T16:11:39.479-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>A Note on Geomancy</title><summary type='text'>The Wikipedia article on Geomancy discusses the mathematical structure of the process. A passing mention to the fact that [d]ue to the mathematics of the chart, only figures that have an even number of points total can become Judges piqued my curiosity. I verified it by computer in an instant, but my curiosity was not satisfied: how can this fact be mathematically proven? It is rather simple, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8230421339121854064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8230421339121854064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8230421339121854064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8230421339121854064'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/09/note-on-geomancy.html' title='A Note on Geomancy'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7838521366228689921</id><published>2011-09-09T11:57:00.001-03:00</published><updated>2011-09-09T12:04:50.309-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>4×4-Bit Matrix Transposition</title><summary type='text'>This is just a quick note to document a concrete variation of the technique for transposing a bit matrix via parallel bit operations in Hacker's Delight 7–3. In this case I needed to specialize it to 4×4 matrices represented by 16-bit integers. The underlying method is to recursively transpose each of the four 2x2-bit submatrices, and then block-transpose the 2x2-block matrix. Numbering the bits </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7838521366228689921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7838521366228689921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7838521366228689921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7838521366228689921'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/09/4-matrix-transposition.html' title='4&amp;times;4-Bit Matrix Transposition'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6964605684237179633</id><published>2011-05-18T15:55:00.006-03:00</published><updated>2011-05-18T16:08:49.198-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Dynamically linked OCurl 0.5.3</title><summary type='text'>Apply this patch to Makefile.in:


15a16
&gt; OCMKLIB  = @OCAMLMKLIB@
23c24
&lt; CFLAGS  = @CFLAGS@ @DEFS@
---
&gt; CFLAGS  = @CFLAGS@ @DEFS@ -fPIC -O2 -DPIC
30,31c31,32
&lt; CURLFLAGS = -ccopt @CURLFLAGS@
&lt; CURLCLIBS = -cclib -lcurl-helper -cclib "@CURLLIBS@"
---
&gt; CURLFLAGS = @CURLFLAGS@
&gt; CURLCLIBS = @CURLLIBS@
49c50
&lt;   $(OCBYTE) -custom -a $(FLAGS) $(CURLFLAGS) -o $@ $(CURLBCOBJS) $(CURLCLIBS)
---
&gt;   $</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6964605684237179633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6964605684237179633' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6964605684237179633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6964605684237179633'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/05/dynamically-linked-ocurl-053.html' title='Dynamically linked OCurl 0.5.3'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-828962056907045600</id><published>2011-05-17T18:35:00.002-03:00</published><updated>2011-05-17T18:36:28.851-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>And Yet They Complain</title><summary type='text'>Compare and contrast. PHP:


&lt;?php
$body = @file_get_contents("php://input");
header('Content-type: text/plain');
print $body;
flush();
?&gt;


Java:


import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/828962056907045600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=828962056907045600' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/828962056907045600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/828962056907045600'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/05/and-yet-they-complain.html' title='And Yet They Complain'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8981223132960929449</id><published>2011-05-07T13:20:00.003-03:00</published><updated>2011-05-07T14:28:27.586-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>A Fork-Join framework on a budget</title><summary type='text'>And by "on a budget" I mean in under 150 lines of code. Commented, no less. Of course this comes with some limitations: I restrict myself to the embarrassingly parallel case where the client code wants to partition a computation equally among identical workers. I also restrict myself to pure OCaml without external dependencies. Furthermore, I have not been entirely diligent with either my error </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8981223132960929449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8981223132960929449' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8981223132960929449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8981223132960929449'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/05/fork-join-framework-on-budget.html' title='A Fork-Join framework on a budget'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4784075340016007748</id><published>2011-02-05T12:26:00.001-03:00</published><updated>2011-02-05T12:26:57.827-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Finding Duplicate Files, on Batteries</title><summary type='text'>I just got another machine. I had to migrate almost 18 years of backups, documents and other digital records. Many of these were duplicated; some I filtered by hand but I needed to automate the bulk of the process. Nothing fancy, just something to guide me in the pruning. To reduce the amount of code needed I dove head first on Batteries. Here is the result, in less than two pages of fully </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4784075340016007748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4784075340016007748' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4784075340016007748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4784075340016007748'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/02/finding-duplicate-files-on-batteries.html' title='Finding Duplicate Files, on Batteries'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7256636382163699875</id><published>2011-02-03T16:47:00.002-03:00</published><updated>2011-02-03T16:53:28.400-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>OCaml 3.12 and ocamlfind ocamldoc</title><summary type='text'>Just a quick note: ocamldoc in 3.12 dumps its help to stderr, unlike every other tool in the distribution. The automatic argument detection of Findlib 1.2.6 fails to catch the output and so does not recognize any command line option. The quick fix is to edit and/or patch tools/extract_args/extract_args.ml, line 32 to read:


Sys.command (sprintf "%s -help &gt;%s 2&gt;&amp;1"


before running ./configure</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7256636382163699875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7256636382163699875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7256636382163699875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7256636382163699875'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/02/ocaml-312-and-ocamlfind-ocamldoc.html' title='OCaml 3.12 and ocamlfind ocamldoc'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2135479957913385580</id><published>2011-01-09T10:05:00.005-03:00</published><updated>2011-01-09T21:21:53.815-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>A jolt, or a shock?</title><summary type='text'>Things in OCaml Batteries that annoy me (i.e., this is merely opinion on my part, and not very informed at that. Caveat lector):

It is incompatible with stdlib in minor random ways:

List.sort requires label ~cmp
Channels are not completely wrapped, so that in_channel_length (open_in_bin "foo") doesn't type


Functional combinators are not what I've grown accustomed to. Turnstiles for </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2135479957913385580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2135479957913385580' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2135479957913385580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2135479957913385580'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2011/01/jolt-or-shock.html' title='A jolt, or a shock?'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-180035841661401682</id><published>2010-11-13T11:48:00.000-03:00</published><updated>2010-11-13T11:49:15.527-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>A First-Principles DNS Client</title><summary type='text'>Ever wondered how nslookup works? I'm a protocol junkie, and Domain Name (RFC 1035) has it all. It's a simple protocol with a highly structured message format, so the rich machinery of OCaml makes easy to build a simple but relatively complete client. The code is long for a blog post (a bit less than 500 lines), so I'll show the highlights and leave the rest for you to use as you see fit. Since </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/180035841661401682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=180035841661401682' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/180035841661401682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/180035841661401682'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/11/first-principles-dns-client.html' title='A First-Principles DNS Client'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8025433047479831260</id><published>2010-10-17T11:58:00.000-03:00</published><updated>2012-01-06T13:43:05.176-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Text to PDF</title><summary type='text'>I find that the best way for me to learn is to reexpress what I read in a different but equivalent form. Transcribing notes and translation are two applications of this heuristic. In this case, I've translated this simple and pretty Factor PDF text formatter into OCaml. The result is almost as compact, at less than 200 lines of code, thanks to the compositional nature that OCaml and Factor share,</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8025433047479831260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8025433047479831260' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8025433047479831260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8025433047479831260'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/10/text-to-pdf.html' title='Text to PDF'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4857795700911941932</id><published>2010-09-14T13:34:00.004-03:00</published><updated>2010-09-14T13:40:15.666-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Parametric Modular Programming</title><summary type='text'>Generic programming as a concept popularized by Stepanov's STL is concerned with the uniform expression of algorithms decoupled from the specific data structures they operate on. By parametric modular programming I mean the uniform expression of a particular algorithm decoupling it from the specific shape of or rules obeyed by the objects it manipulates. It resolves the same driving forces behind</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4857795700911941932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4857795700911941932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4857795700911941932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4857795700911941932'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/09/parametric-modular-programming.html' title='Parametric Modular Programming'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7074949462450985008</id><published>2010-09-01T14:04:00.001-03:00</published><updated>2010-09-01T18:21:26.094-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Rewriting the Rules</title><summary type='text'>The last article on pa_do sparked an interesting conversation with its author, Christophe Troestler, and reader bluestorm. It's true that pa_infix can establish optional rewrite rules for operators as a side-effect (or as an "added bonus" in the creator's words) of it installing new symbols with given arity, precedence and associativity. Given that rewrite rules are purely syntactical artifacts, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7074949462450985008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7074949462450985008' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7074949462450985008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7074949462450985008'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/09/rewriting-rules.html' title='Rewriting the Rules'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6661028246401696720</id><published>2010-08-22T11:34:00.000-03:00</published><updated>2010-08-22T11:35:14.614-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Polymorphic recursion with rank-2 polymorphism in OCaml 3.12</title><summary type='text'>Using polymorphic recursion in OCaml just got easy and direct! With the new syntax, Okasaki's binary random-access lists translate to OCaml 3.12 practically verbatim, without the need for cumbersome encodings. You should refer to the book (Purely Functional Data Structures, p. 147) for comparison, but here's the implementation in its entirety:


type 'a seq = Nil | Zero of ('a * 'a) seq | One of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6661028246401696720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6661028246401696720' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6661028246401696720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6661028246401696720'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/08/polymorphic-recursion-with-rank-2.html' title='Polymorphic recursion with rank-2 polymorphism in OCaml 3.12'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4181721562581721443</id><published>2010-08-18T11:13:00.002-03:00</published><updated>2010-08-18T11:14:39.402-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>What can pa_do for you?</title><summary type='text'>(My puns are getting worse) A lot of things. Christophe Troestler pointed out that pa_do is a much more complete alternative to the new delimited overloading syntax in OCaml 3.12. In particular, it allows not only for the overloading of operators but of constants also, so that the following:


# Num.(3**(561-1) mod 561);;
- : Num.num = &lt;num 375&gt;


(561 = 3×11×17) works, with the simple (!) </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4181721562581721443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4181721562581721443' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4181721562581721443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4181721562581721443'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/08/what-can-pado-for-you.html' title='What can pa_do for you?'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1966521527089006583</id><published>2010-08-16T14:47:00.001-03:00</published><updated>2010-08-16T14:51:18.019-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Compiling OMake 0.9.8.5 with OCaml 3.12/MinGW under Cygwin</title><summary type='text'>Success! Since OMake doesn't really have a notion of a build environment, just one of platform (UNIX or Win32), compiling the latest release (0.9.8.5-3) from sources requires a number of modifications to the makefiles. Furthermore, OCaml has incorporated a number of warnings that make necessary adjusting some command-line parameters.


Note: These steps are specifically for the MinGW port of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1966521527089006583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1966521527089006583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1966521527089006583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1966521527089006583'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/08/compiling-omake-0985-with-ocaml.html' title='Compiling OMake 0.9.8.5 with OCaml 3.12/MinGW under Cygwin'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7000069636141517460</id><published>2010-08-14T01:29:00.003-03:00</published><updated>2010-08-14T10:50:50.271-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Smooth Operators</title><summary type='text'>Edit: Of course the module Num is already present in the standard library. I've renamed the module to Arith.

The newly-released OCaml 3.12 includes many extensions to the sub-language of modules. One of the simplest but most practical is the syntax for locally opening modules (let open M in e), and for evaluating expressions in the context of an implicitly-opened module (M.(e), equivalent to the</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7000069636141517460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7000069636141517460' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7000069636141517460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7000069636141517460'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/08/smooth-operators.html' title='Smooth Operators'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7825166475163392638</id><published>2010-08-05T14:07:00.002-03:00</published><updated>2010-08-06T09:13:18.937-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Reviving an Old Tiger</title><summary type='text'>An old machine that proved its mettle on the line can be a handy development server, on a pinch. Especially if you're starting up by pulling your boot straps, as I currently am. I have this Blue &amp; White G3 that served me faithfully for the last, say, 10 years. Bitrot, alas, is not a hardware problem: software version numbers climb and software authors drop support for older operating systems and </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7825166475163392638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7825166475163392638' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7825166475163392638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7825166475163392638'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/08/reviving-old-tiger.html' title='Reviving an Old Tiger'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2801277724473703751</id><published>2010-07-02T14:24:00.002-03:00</published><updated>2010-07-02T14:26:23.963-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Sukhotin's Algorithm</title><summary type='text'>There is an obscure algorithm devised by one Boris Viktorovich Sukhotin, a Russian… linguist? mathematician? cryptographer? let's say researcher, in the early '70s, usually called Sukhotin's Vowel Identification Algorithm, whose initial aim was to quickly attack an alphabetic cyphertext encoded with an unknown substitution cypher. Jacques Guy, a linguist and programmer well-known for his interest</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2801277724473703751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2801277724473703751' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2801277724473703751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2801277724473703751'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/07/sukhotins-algorithm.html' title='Sukhotin&apos;s Algorithm'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-9139337803557681516</id><published>2010-06-11T21:25:00.002-03:00</published><updated>2010-06-12T08:57:18.495-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Diagonalize, Now!</title><summary type='text'>It is easy to append two lists, and the method is well-known:


let rec append xs ys = match xs with
| []      -&gt; ys
| x :: xs -&gt; x :: append xs ys


It is also easy to merge two lists, so that elements from the first are interleaved with those of the second:


let rec merge xs ys = match xs with
| []      -&gt; ys
| x :: xs -&gt; x :: merge ys xs


A simple matter of swapping two arguments! The </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/9139337803557681516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=9139337803557681516' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/9139337803557681516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/9139337803557681516'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/06/diagonalize-now.html' title='Diagonalize, Now!'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2486911275423622066</id><published>2010-06-10T18:49:00.001-03:00</published><updated>2010-06-10T18:51:44.213-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>You are Here</title><summary type='text'>I am a terrible person: I read code, I think to myself "I can do better" and I set out thus, out of pride. I did just that with an OCaml implementation of the geohash geographical encoding. Even if the code I read was perfectly workable, I found it unidiomatic and somewhat bloated. I wrote two versions, the first one compact but impenetrable, the second one from first principles: what would be an</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2486911275423622066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2486911275423622066' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2486911275423622066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2486911275423622066'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/06/you-are-here.html' title='You are Here'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8378722549377270286</id><published>2010-05-28T23:34:00.002-03:00</published><updated>2010-05-29T00:35:14.576-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Gematric Search</title><summary type='text'>Given an array A.(0 ≤ i &lt; N) of nonnegative integers, that is:


(0)   〈∀ i : 0 ≤ i &lt; N : A.i ≥ 0〉


and a positive integer s &gt; 0, we want to find a segment of A that sums to s, if it exists. Define:


      S.i.j = 〈∑ k : 0 ≤ i ≤ k &lt; j ≤ N : A.k〉


The gematric search for s in A is to find, if possible, a pair (p, q) such that S.p.q = s (it is hoped that conoisseurs would readily make the </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8378722549377270286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8378722549377270286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8378722549377270286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8378722549377270286'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/05/gematric-search.html' title='Gematric Search'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1104525395342936472</id><published>2010-05-15T22:06:00.002-03:00</published><updated>2010-05-16T14:02:42.692-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Observable sharing and executable proofs</title><summary type='text'>Every rational number has an infinite repeating decimal expansion. In particular, every integer admits two decimal expansions: one with and one without a "tail of nines". This means that 1 = 0.9999…, a provable fact that many people still choose to disbelieve. What do I mean here by "provable"? I mean "provable by finitistic reasoning", that is, by a purely algebraic proof free of notions of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1104525395342936472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1104525395342936472' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1104525395342936472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1104525395342936472'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/05/observable-sharing-and-executable.html' title='Observable sharing and executable proofs'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1420537883561409365</id><published>2010-04-23T08:21:00.002-03:00</published><updated>2010-05-01T21:02:31.523-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><title type='text'>Properly Bound</title><summary type='text'>To all practitioners: the type of bind is not the type of &gt;&gt;=. For a monad α m, the latter has type:


val (&gt;&gt;=) : α m → (α → β m) → β m


only because &gt;&gt;= is used as a combinator that allows pipelining computations from left to right, as per usual convention:


… m &gt;&gt;= fun x →
  n &gt;&gt;= fun y →
  …
  return f x y


On the other hand, if you want to take maximum advantage of the Theorems for Free! </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1420537883561409365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1420537883561409365' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1420537883561409365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1420537883561409365'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/04/properly-bound.html' title='Properly Bound'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4999132093476897202</id><published>2010-04-22T20:44:00.001-03:00</published><updated>2010-04-22T20:44:40.460-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>The elusive Binary Search</title><summary type='text'>Jon Bentley has scarred a couple of generations of programmers, or he was and continues to be right:


I've assigned this problem in courses at Bell Labs and IBM. […] In several classes and with over a hundred programmers, the results varied little: ninety percent of the programmers found bugs in their programs (and I wasn't always convinced of the correctness of the code in which no bugs were </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4999132093476897202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4999132093476897202' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4999132093476897202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4999132093476897202'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/04/elusive-binary-search.html' title='The elusive Binary Search'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3794709406113001624</id><published>2010-03-22T20:39:00.003-03:00</published><updated>2011-09-16T16:01:58.453-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Oleg'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Haskell'/><title type='text'>GADTs for the Rest of Us</title><summary type='text'>In a nutshell, generalized algebraic data types, or GADTs for short, are a first-class phantom type of sorts. The basic idea is to enrich the constructors of an ADT with a more expressive "return" type by allowing the instantiation of one or more type parameters. A simple motivating example is that of an abstract syntax in Peyton Jones's original paper:data Term a where
  Lit  :: Int        -&gt; </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3794709406113001624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3794709406113001624' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3794709406113001624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3794709406113001624'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/03/gadts-for-rest-of-us.html' title='GADTs for the Rest of Us'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8085461036671945792</id><published>2010-02-21T12:37:00.002-03:00</published><updated>2010-02-21T12:43:36.398-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Braun Trees</title><summary type='text'>I had a couple of interesting comments on my post about heaps and priority queues. The first is by Jérôme and is an indictment against my wrong, naïve use of Obj.magic to fake initializing extensible Vecs in the presence of double-word unboxed float arrays. There are a number of avenues to repair the defect:


Use a functorial interface and monomorphize the type of vectors
Use an exemplar of the </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8085461036671945792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8085461036671945792' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8085461036671945792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8085461036671945792'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/02/braun-trees.html' title='Braun Trees'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4715159519399974997</id><published>2010-02-16T17:38:00.003-03:00</published><updated>2010-02-21T12:51:27.960-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>A Heap of (Regular) Strings</title><summary type='text'>Once you have a priority queue, suddenly it gets put to use more than once. Reading Pete Manolios' "Enumerating the strings of a Regular Expression", I found (§ 3.4) the following single-paragraph explanation of an algorithm for generating all the strings accepted by a DFA:


Another approach is to […] enumerate the expression using the DFA. This can be done with a function enumDfa whose single </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4715159519399974997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4715159519399974997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4715159519399974997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4715159519399974997'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/02/heap-of-regular-strings.html' title='A Heap of (Regular) Strings'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1116893920709098070</id><published>2010-02-14T11:23:00.001-03:00</published><updated>2010-02-14T11:26:59.277-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Heap Up (the Bernstein Sums)</title><summary type='text'>Happy Valentine's! The latest Programming Praxis calls for an implementation of the prime Sieve of Atkins. This sieve saves a bunch of operations with a preprocessing phase in which only square-free candidates are retained for latter sieving. For this to be efficient it is necessary to quickly count solutions to certain binary quadratic forms k·x² ± y² = n. Dan Berstein has published an elegant </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1116893920709098070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1116893920709098070' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1116893920709098070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1116893920709098070'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/02/heap-up-bernstein-sums.html' title='Heap Up (the Bernstein Sums)'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-668251954329816815</id><published>2010-01-19T19:58:00.002-03:00</published><updated>2010-02-15T11:09:59.280-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Haskell'/><title type='text'>A Staggering Sequence</title><summary type='text'>Happy new year! Inspired by N. J. A. Sloane's Seven Staggering Sequences, I started thinking about the Gijswijt sequence, A090822 in the OEIS. What appealed to me was the notion of "word logarithm" implicit in its definition:


We begin with b(1) = 1. The rule for computing the next term, b(n + 1), is again rather unusual. We write the sequence of numbers we have seen so far, b(1), b(2),… b(n) in</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/668251954329816815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=668251954329816815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/668251954329816815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/668251954329816815'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2010/01/staggering-sequence.html' title='A Staggering Sequence'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1662170117655338342</id><published>2009-12-24T14:12:00.000-03:00</published><updated>2009-12-24T14:13:54.300-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Functional Macramé</title><summary type='text'>What is the meaning of an expression like


let rec e = f … e …


known Haskell is as "knot-tying"? As Lloyd Allison explains:


A circular program creates a data structure whose computation depends upon itself or refers to itself. The technique is used to implement the classic data structures circular and doubly-linked lists, threaded trees and queues, in a functional programming language. These</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1662170117655338342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1662170117655338342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1662170117655338342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1662170117655338342'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/12/functional-macrame.html' title='Functional Macramé'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7396453513654626747</id><published>2009-12-23T20:35:00.000-03:00</published><updated>2009-12-23T20:36:05.082-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Gained in Translation</title><summary type='text'>First of all, I'd like to apologize for the infrequent updates and the lightness of the last few entries. I seldom have time of late for anything but the quickest of finger exercises, but I wanted to put something on writing before the year is over. What better inspiration than one of Remco Niemeijer's terse solutions to the daily Programming Praxis. This week's asks for an implementation of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7396453513654626747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7396453513654626747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7396453513654626747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7396453513654626747'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/12/gained-in-translation.html' title='Gained in Translation'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3247930542271817500</id><published>2009-11-06T20:42:00.000-03:00</published><updated>2009-11-06T20:43:41.563-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Reflecting on One-Liners</title><summary type='text'>The delightful Futility Closet posted a simple puzzler about the next year after 1961 that reads the same upside down. It is quite easy to see that it will be 6009, and to convince oneself that indeed no smaller number exists a dozen of lines of code suffice.

The key to concision is to lift the syntax and semantics of monads into the problem. Since not every digit is itself a digit upon rotation</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3247930542271817500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3247930542271817500' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3247930542271817500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3247930542271817500'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/11/reflecting-on-one-liners.html' title='Reflecting on One-Liners'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8883808110139404807</id><published>2009-08-30T00:19:00.001-03:00</published><updated>2009-08-30T00:19:54.029-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Haskell'/><title type='text'>Fun with (Type) Class</title><summary type='text'>I'd like to motivate OCaml's object-oriented features (the "O" in "OCaml") by showing an encoding of (first-order) Haskell type classes. This will require making use of almost everything in OCaml's object buffet: class types, virtual classes, inheritance of class types and of classes, double dispatch and coercion.

Haskell could be said to have the best type system among all languages in wide use</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8883808110139404807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8883808110139404807' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8883808110139404807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8883808110139404807'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/08/fun-with-type-class.html' title='Fun with (Type) Class'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8517694945014368413</id><published>2009-07-21T11:24:00.002-03:00</published><updated>2009-07-21T11:39:51.250-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>(Dis)Functional Bowling</title><summary type='text'>It is saddening to see people invested so heavily in cargo-cult programming practices that they cannot see natural solutions to simple problems after having their thoughts twisted by object-orientation as an ends and TDD as a fighting technique. Uncle Bob is struggling (and failing) to approach functional programming in the natural way by what seems to be his biases and commercial interests. His </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8517694945014368413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8517694945014368413' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8517694945014368413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8517694945014368413'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/07/disfunctional-bowling.html' title='(Dis)Functional Bowling'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6890954915418556286</id><published>2009-07-19T01:16:00.000-03:00</published><updated>2009-07-19T01:17:51.596-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Monadic Golf</title><summary type='text'>Reading Bonsai Code's solutions to Programming Praxis's weekly puzzles (which I can't recommend highly enough) makes me feel acutely aware of how verbose OCaml is, and how inadequate its standard library when compared to Haskell's. However, I've found that the latest puzzles yield concisely to a monadic style over the lists.

Breaking with my usual literate top-down presentation I'll concentrate </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6890954915418556286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6890954915418556286' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6890954915418556286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6890954915418556286'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/07/monadic-golf.html' title='Monadic Golf'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8079710970693135431</id><published>2009-06-17T23:48:00.003-03:00</published><updated>2009-06-17T23:52:32.389-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>The Tree Nursery</title><summary type='text'>On my last post, Benedikt Grundmann asked if changing representations for trie nodes, in particular eliminating 'a option-boxed references, would represent a speed-up or not. I started tinkering with a direct representation:


type 'a t =
{ value : 'a option;
  split : char;
  lokid : 'a t;
  eqkid : 'a t;
  hikid : 'a t; }


(call this representation trie1). This forces me to use a sentinel node</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8079710970693135431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8079710970693135431' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8079710970693135431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8079710970693135431'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/tree-nursery.html' title='The Tree Nursery'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1150278724914619268</id><published>2009-06-15T12:41:00.001-03:00</published><updated>2009-06-15T12:41:49.336-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Simple, Efficient Trie Maps</title><summary type='text'>I became interested in implementing Bentley and Sedgewick's Ternary Trees by reading the challenge proposed on Programming Praxis (a great blog, by the way). I thought the algorithms would be a good fit for a purely functional data structure, and I am happy with the results. Here is my implementation.

I follow the Map.S signature, so that this can be a drop-in replacement for string-keyed maps, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1150278724914619268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1150278724914619268' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1150278724914619268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1150278724914619268'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/simple-efficient-trie-maps.html' title='Simple, Efficient Trie Maps'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8422857548663589844</id><published>2009-06-14T23:19:00.003-03:00</published><updated>2009-06-14T23:23:39.224-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Algorithm-conscious, cache-oblivious</title><summary type='text'>No matter how credentialed a writer is, he is bound to make a mistake in print sooner or later. Raymond Chen's latest entry was for me oddly synchronous and oddly at variance with my own investigations on Bentley and Sedgewick's Ternary Trees. His apology of the hash table is technically sound, but only on the surface: there is not a single measurement to back up his assertions. Here is my data.
</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8422857548663589844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8422857548663589844' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8422857548663589844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8422857548663589844'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/algorithm-conscious-cache-oblivious.html' title='Algorithm-conscious, cache-oblivious'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7290417717929493605</id><published>2009-06-12T21:32:00.003-03:00</published><updated>2009-06-12T21:51:31.203-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Hash 'n Mix</title><summary type='text'>How good is the hash function in your language of choice, particularly for strings? Chances are, not very. I applied the classical statistical tests popularized by Knuth and I was very surprised to see how bad OCaml's hash function on strings is.

I applied the chi-square test on the distribution of hashes over /usr/share/dict/words, for almost 235.000 words. I binned the integers from the most </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7290417717929493605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7290417717929493605' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7290417717929493605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7290417717929493605'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/hash-n-mix.html' title='Hash &apos;n Mix'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6762562768694175355</id><published>2009-06-05T16:43:00.001-03:00</published><updated>2009-06-05T16:44:41.266-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Euler's Power Riffs</title><summary type='text'>Ed Sandifer is an exegete of Euler's methods. In his latest "How Euler Did It", he shows the method through which he arrived at closed polynomials for the sums of n-th powers of the first x integers:


In general, Euler has us multiply the terms of Σxn by (n + 1)/(n + 2) x, (n + 1)/(n + 1) x, (n + 1)/n x, … (n + 1)/2 x and (n + 1)/1 x, respectively, and add the appropriate linear term and to get </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6762562768694175355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6762562768694175355' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6762562768694175355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6762562768694175355'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/eulers-power-riffs.html' title='Euler&apos;s Power Riffs'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-885855630896733357</id><published>2009-06-05T15:11:00.003-03:00</published><updated>2009-06-05T15:15:57.157-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Immutability Redux</title><summary type='text'>My last post generated a ton of very interesting discussion. I'd like to summarize it here to bring the topic to closure.

In view of the excellent analysis performed by Mauricio Fernández , Ketan's comment:


At this point, you don't have the data to say what you said. You could just as easily say OCaml penalizes mutable data, or, less judgmentally, that it is less well-optimized for that use </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/885855630896733357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=885855630896733357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/885855630896733357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/885855630896733357'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/06/immutability-redux.html' title='Immutability Redux'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1433390099686664933</id><published>2009-05-26T01:15:00.000-03:00</published><updated>2009-05-26T01:16:35.577-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Benchmark'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Is Immutable Data Slow?</title><summary type='text'>Is immutatble data always slower than mutable state? I was challenged in a discussion over at Reddit about this issue, and I decided to perform a little experiment to back up a rough estimate with some numbers. I was surprised and delighted to see that I could make my case very strong indeed by showing that no, immutable data can be twice as fast as mutable data in a modern functional language.

</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1433390099686664933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1433390099686664933' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1433390099686664933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1433390099686664933'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/05/is-immutable-data-slow.html' title='Is Immutable Data Slow?'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1337046814614064557</id><published>2009-05-14T10:10:00.001-03:00</published><updated>2009-05-14T10:10:52.408-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><title type='text'>A Polymorphic Question</title><summary type='text'>Chris Conway asked a question that I replied, unwittingly, with a reference to a thread he started on the OCaml mailing list exactly two years ago: what is the difference between types 'a . int -&gt; 'a vec -&gt; 'a and int -&gt; 'a vec -&gt; 'a?

Strictly speaking, the latter is, in isolation, ill formed: the type variable 'a is unbounded! The convention is to implicitly universally quantify all unbound </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1337046814614064557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1337046814614064557' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1337046814614064557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1337046814614064557'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/05/polymorphic-question.html' title='A Polymorphic Question'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6906845348374817323</id><published>2009-05-13T00:51:00.002-03:00</published><updated>2009-05-13T00:55:34.248-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Okasaki's Random Access Lists</title><summary type='text'>To close the chapter on Okasaki's Random Access Lists, I must record that there is an errata on the bottom of page 145 of his Purely Functional Data Structures. The argument to the recursive call to update it must read Zero (update (i div 2, p, ps)) end. It took me a while to figure it out, thinking that I had made a mistake.

For completeness, here's the translation for the chapter's pseudo-SML </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6906845348374817323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6906845348374817323' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6906845348374817323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6906845348374817323'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/05/okasakis-random-access-lists.html' title='Okasaki&apos;s Random Access Lists'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2082533379112586506</id><published>2009-05-12T22:15:00.003-03:00</published><updated>2009-05-13T00:53:03.779-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Rank-2 polymorphism and non-uniform types, revisited</title><summary type='text'>I've committed a number of errors and inaccuracies in my last post that warrant clarification. The most egregious and urgent is that the definition I gave for length is utterly wrong: the type encodes the length from the inside out, so that its "most significant bit" is the inner constructor. The recursion must take the form of a right fold, not of a left fold as I wrote. The correct function is </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2082533379112586506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2082533379112586506' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2082533379112586506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2082533379112586506'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/05/rank-2-polymorphism-and-non-uniform.html' title='Rank-2 polymorphism and non-uniform types, revisited'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2130148721496527615</id><published>2009-05-10T00:20:00.002-03:00</published><updated>2009-05-10T20:43:30.647-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Polymorphic Recursion</title><summary type='text'>Re-reading for the n-th time Chris Okasaki's From Fast Exponentiation to Square Matrices: An Adventure in Types, I tried my hand at seeing how does the latest OCaml version cope with non-regular types and the consequent polymorphic recursion. I first scoped the terrain and Googled what others had to say about this topic. I found a ten-year old OCaml Mailing List post where Pierre Weiss mentions </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2130148721496527615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2130148721496527615' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2130148721496527615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2130148721496527615'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/05/polymorphic-recursion.html' title='Polymorphic Recursion'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-276632601941204149</id><published>2009-03-07T22:10:00.000-02:00</published><updated>2009-03-07T22:11:23.089-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Simple Future</title><summary type='text'>A future is a computation that encapsulates the notion of asynchronously computing a value. Let me deconstruct the buzzwords:


By "computation" I mean a mechanism that, eventually, reduces to or contains a value
By "value" I mean a primitive object that cannot be reduced further, or rather a computation that is trivial in the sense that it returns itself when run
By "asynchronous" I mean that </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/276632601941204149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=276632601941204149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/276632601941204149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/276632601941204149'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/03/simple-future.html' title='Simple Future'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1687284957761996622</id><published>2009-03-05T11:19:00.003-02:00</published><updated>2009-03-05T14:03:11.975-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Small Sorts</title><summary type='text'>I have seen in more than one occasion sorting problems of small sizes being solved with general-purpose sorting routines. The case should be analogous to FFTs of small size, where the cases for 1-point, 2-point and 4-point transforms are special, straight-line code segments; but I haven't found the equivalent special-casing of small-size sorts. One reason for that could be that the structure of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1687284957761996622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1687284957761996622' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1687284957761996622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1687284957761996622'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/03/small-sorts.html' title='Small Sorts'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_UyZUuTKh-wQ/RvqaGQwOp9I/AAAAAAAAAB8/KClHTw8068k/s72-c/tree.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1038779255299034281</id><published>2009-01-09T12:00:00.001-02:00</published><updated>2009-01-09T12:04:30.264-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><title type='text'>Why so Series</title><summary type='text'>Notational Notions has an entry raising to the challenge of showing with power series that (sin x)² + (cos x)² = 1. I jestingly but unfairly called the author a cheater for using what to me was an obvious appeal to Euler's formula (I made a mistake in naming it as De Moivre's). I reasoned thus:


  (sin x)² + (cos x)²
= { Euler: e^ix - e^(-ix) = 2i sin x }
  [(e^ix - e^(-ix))/(2i)]² + [(e^ix + e^</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1038779255299034281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1038779255299034281' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1038779255299034281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1038779255299034281'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/01/why-so-series.html' title='Why so Series'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-77739271377478383</id><published>2009-01-08T00:56:00.003-02:00</published><updated>2009-01-08T01:02:35.574-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>The Essence of Concatenative Languages</title><summary type='text'>Andreas Rossberg defined a concise and elegant type system for the concatenative language Cat created by Christopher Diggins that makes clear, once and for all, that the nature of the paradigm is solidly functional, point-free and higher order in a way that, as John Nowak remarks, goes beyond the original conception of Backus' FP. Here I wish to contribute to fixing these important ideas by </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/77739271377478383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=77739271377478383' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/77739271377478383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/77739271377478383'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/01/essence-of-concatenative-languages.html' title='The Essence of Concatenative Languages'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-303285116941500351</id><published>2009-01-07T17:30:00.003-02:00</published><updated>2009-01-07T18:16:46.787-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>The limits of Hindley-Milner</title><summary type='text'>The simplest thing in the world. Concatenate two pairs of lists component-wise:


# fun (a, x) (b, y) -&gt; (a @ b, x @ y) ;;
- : 'a list * 'b list -&gt; 'a list * 'b list -&gt; 'a list * 'b list = &lt;fun&gt;


Why, let's abstract out the concatenation part and call it thread, so that it lifts a binary function to operate on pairs component-wise:


# let thread f (a, x) (b, y) = (f a b, f x y) ;;
val thread : </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/303285116941500351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=303285116941500351' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/303285116941500351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/303285116941500351'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/01/limits-of-hindley-milner.html' title='The limits of Hindley-Milner'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-433278768325733651</id><published>2009-01-05T14:38:00.001-02:00</published><updated>2009-01-05T14:38:45.192-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><title type='text'>Ring Laws</title><summary type='text'>This is a really basic derivation of elementary facts about rings, just for the record. I follow Milne's definition of a ring (R, +, 0, -, ⋅ 1) as a commutative group (R, +, 0, -) equipped with an additional operation ⋅ and a distinguished 1 ∈ R such that (R, ⋅, 1) is a monoid, and ⋅ distributes over + both on the left and on the right: for all a, b, c ∈ R


(a + b)⋅c = a⋅c + b⋅c
a⋅(b + c) = a⋅b </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/433278768325733651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=433278768325733651' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/433278768325733651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/433278768325733651'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2009/01/ring-laws.html' title='Ring Laws'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6239850708725618301</id><published>2008-12-17T23:13:00.001-02:00</published><updated>2008-12-19T12:15:18.561-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Proof-directed Debugging: A Real Example</title><summary type='text'>I was reading this excellent introduction to the K programming language (go ahead, get immersed into it. I'll wait for you) when I got piqued by the strange function where:


  &amp;1 2 3 4     / where: returns the number of units specified
0 1 1 2 2 2 3 3 3 3

  &amp;0 1 1 0 0 1 / where: an important use to get the indices of the 1s
1 2 5


Beyond the need (or not) for such a function, my immediate </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6239850708725618301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6239850708725618301' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6239850708725618301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6239850708725618301'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/12/proof-directed-debugging-real-example.html' title='Proof-directed Debugging: A Real Example'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4835927627886646090</id><published>2008-12-02T00:36:00.002-02:00</published><updated>2008-12-02T00:39:26.128-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Stream of Consciousness</title><summary type='text'>Wouldn't you like to write code like this:


reading "ebooks/345.txt" (
   lines
|&gt; skip_until (matches "^\\*\\*\\* START OF")
|&gt; skip
|&gt; filter is_empty
|&gt; words
|&gt; fmap String.uppercase
|&gt; take 20
|&gt; to_list
)


and have it spit:


- : string list =
["DRACULA"; "BY"; "BRAM"; "STOKER"; "1897"; "EDITION"; "TABLE"; "OF";
 "CONTENTS"; "CHAPTER"; "1"; "JONATHAN"; "HARKER'S"; "JOURNAL"; "2";
 "</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4835927627886646090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4835927627886646090' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4835927627886646090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4835927627886646090'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/12/stream-of-consciousness.html' title='Stream of Consciousness'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-5548014045253573028</id><published>2008-11-09T20:57:00.001-02:00</published><updated>2008-11-09T21:06:28.261-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>(One Flew Over The) Cuckoo's Hash</title><summary type='text'>In a conversation over reddit, reader nostrademons suggested Cuckoo Hashing as a hash scheme with constant-time worst-case look-ups. References to the algorithm abound, but implementations are scarce, so I set out to write code. It turned out to be more difficult than I anticipated.

The original article describing Cuckoo Hashing explains the basic scheme better than the Wikipedia article does, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/5548014045253573028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=5548014045253573028' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/5548014045253573028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/5548014045253573028'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/11/one-flew-over-cuckoos-hash.html' title='(One Flew Over The) Cuckoo&apos;s Hash'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3886826072794241802</id><published>2008-11-09T12:37:00.003-02:00</published><updated>2008-11-09T15:52:23.407-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Meta'/><title type='text'>Wordle</title><summary type='text'>Are wordles a novel visualization technique, or the Applet-equivalent of fridge magnet poetry? I'm not decided; meanwhile, I've compiled one of all my posts in the last year or so. Pure vanity, perhaps, but with pretty results:



</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3886826072794241802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3886826072794241802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3886826072794241802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3886826072794241802'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/11/wordle.html' title='Wordle'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/SRcjRaJLwEI/AAAAAAAAAIg/IajflXECMrM/s72-c/Picture+1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-628710749953220520</id><published>2008-10-31T20:44:00.000-02:00</published><updated>2008-10-31T20:45:24.907-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Group-By Redux</title><summary type='text'>I sometimes like to defunctionalize a recursive function to see what shadow it projects against the wall of the cave. OCaml being strict, the tail recursive, eager, "imperative" version of the function is dual to the "pure", functional one. I've written before about the chain from direct style to CPS to defunctionalization, so I'll not make this a tutorial but a worked-out example. Starting from </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/628710749953220520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=628710749953220520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/628710749953220520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/628710749953220520'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/10/group-by-redux.html' title='Group-By Redux'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8165292520614012380</id><published>2008-10-29T21:21:00.000-02:00</published><updated>2008-10-29T21:22:37.263-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Extreme Recursion</title><summary type='text'>For a data processing application, I needed a way to group data records together according to some criteria. This is the "reduce" phase of the map-reduce transformation, or the group-by phase of a select-project-group query.

My specific problem called for a way to group records in an input list into output sublists by testing them against the first such record considered. More specifically, the </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8165292520614012380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8165292520614012380' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8165292520614012380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8165292520614012380'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/10/extreme-recursion.html' title='Extreme Recursion'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4633108753478779892</id><published>2008-10-15T19:30:00.003-03:00</published><updated>2008-10-15T19:35:20.188-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Top Drawing</title><summary type='text'>I wrote the last time about simple ways to "just get something onto the screen", and I ended by exploring a simple Top Draw program. I hinted at the ease with which Top Draw allows compositing a complex "painting", taking more or less by fiat the examples included with the program. I since took advantage of the basic rosette drawing subroutine to make a wallpaper that I could actually install:


</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4633108753478779892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4633108753478779892' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4633108753478779892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4633108753478779892'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/10/top-drawing.html' title='Top Drawing'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/SPZv78ByF7I/AAAAAAAAAIY/q_vdYirJGxE/s72-c/Image-4.jpeg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4971386105264743048</id><published>2008-10-13T12:49:00.005-03:00</published><updated>2012-01-06T13:44:27.894-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Procedural Drawing</title><summary type='text'>Pretty pictures, again. There are now a number of "toys" with which to "recreate" the experience of turning on the old computer (C-64, Spectrum, Apple II or what had you) and being greeted with a BASIC prompt. I've written before about how SDL can give you a simple, direct (!) buffer to which to write pixels; the problem it has is that it does not know anything about drawing any object more </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4971386105264743048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4971386105264743048' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4971386105264743048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4971386105264743048'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/10/procedural-drawing.html' title='Procedural Drawing'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/SPNucXTjCVI/AAAAAAAAAII/XR5zyEGvowY/s72-c/daisy.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1069146143745337003</id><published>2008-08-31T13:54:00.002-03:00</published><updated>2012-01-06T13:44:27.879-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Just draw something on the screen!</title><summary type='text'>Nostalgia for times past sometimes leads to frustration and anger. Yes, times are harder for would-be pixel artists, but nothing a little work can't solve. Let's do fractals in OCaml!

Suppose you've already installed the wonderful findlib (vielen Dank, Herr Stolpmann!). Suppose, furthermore, you've succeded in compiling OcamlSDL. This might look like a heavy prerequisite to fulfill before </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1069146143745337003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1069146143745337003' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1069146143745337003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1069146143745337003'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/just-draw-something-on-screen.html' title='Just draw something on the screen!'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_UyZUuTKh-wQ/SLrNCFELdLI/AAAAAAAAAHw/gvZyafqFvfo/s72-c/newton3.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6346865964861716424</id><published>2008-08-17T22:14:00.004-03:00</published><updated>2012-01-06T13:44:27.901-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Aperiodic Tilings</title><summary type='text'>When you thought that your obsession had run its course and left you in peace, finally, along comes something new and shiny to once more lead you astray. I've written half a dozen posts about sorting networks and genetic algorithms; I thought I had put that topic to rest. What am I to do when I find the Tilings Encyclopedia later the same week? How could I resist this aperiodic fest of </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6346865964861716424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6346865964861716424' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6346865964861716424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6346865964861716424'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/aperiodic-tilings.html' title='Aperiodic Tilings'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_UyZUuTKh-wQ/SKjN8o3a_nI/AAAAAAAAAHY/IHfpOVtP-_0/s72-c/ammanbeenker_4.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6238747771345769656</id><published>2008-08-15T21:02:00.001-03:00</published><updated>2008-08-15T21:24:30.681-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Monads are Plug-ins</title><summary type='text'>As Haskell gains popularity, a dozen articles or more a month about them make the front page at the Programming reddit. Most deal with the necessity of using and understanding monads to control side-effects in Haskell. This is only natural and to be expected since, in Haskell, they're a language design decision, and as such as inescapable as laziness and as structural as the predefined operator </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6238747771345769656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6238747771345769656' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6238747771345769656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6238747771345769656'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/monads-are-plug-ins.html' title='Monads are Plug-ins'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/SKYd6de0hjI/AAAAAAAAAHQ/KwPUVRwiT1k/s72-c/amman_4.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4757384540566671834</id><published>2008-08-05T21:04:00.001-03:00</published><updated>2008-12-09T16:48:30.173-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>A Family Portrait</title><summary type='text'>I succeeded in finding a minimal 8-element sorting network with 19 comparators grouped in 6 stages. For that, I needed a change in my fitness evaluation function to reflect an insight I had while preparing the last post. My original fitness evaluator was monotone first on size and then on depth, so that fitness(s, d) &lt; fitness(s′, d′)   ⇔   s &lt; s′  ∨  s = s′ ∧ d &lt; d′. It is, I found </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4757384540566671834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4757384540566671834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4757384540566671834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4757384540566671834'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/family-portrait.html' title='A Family Portrait'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_UyZUuTKh-wQ/SJjonIdli6I/AAAAAAAAAGY/4F6Kj36jOL4/s72-c/net3_3_3.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1259010337600014053</id><published>2008-08-04T21:06:00.002-03:00</published><updated>2008-08-04T21:08:20.918-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Sorting out Creationism</title><summary type='text'>I told you there's no end to tweaking a Genetic Algorithm. As it is, the program is not very powerful; it cannot find minimal networks of width 7:


% ./ganet -width 7 -pool 100 -seed 11
Searching for a 7-network of size 16 and depth 6 (fitness = 34.00000)
      1 act =  3.00%, avg = 8.66667, max = 10.00000 (39/24)
      2 act =  4.00%, avg = 9.25000, max = 11.00000 (38/23)
      3 act =  6.00%, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1259010337600014053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1259010337600014053' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1259010337600014053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1259010337600014053'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/sorting-out-creationism.html' title='Sorting out Creationism'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-855300533956352389</id><published>2008-08-04T00:05:00.000-03:00</published><updated>2008-08-04T00:06:00.417-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Sorting out Evolution</title><summary type='text'>As a belated end to my exploration of sorting networks (1, 2, 3, 4, 5), I experimented with genetic algorithms to find minimal sorting networks for n elements. And when I write experimented, I mean a couple of weeks of tweaking parameters and code exploring ways for my program to run faster, and to find better and larger networks. Before you continue reading, let me warn you that I wasn't </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/855300533956352389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=855300533956352389' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/855300533956352389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/855300533956352389'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/08/sorting-out-evolution.html' title='Sorting out Evolution'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-6455125937759010819</id><published>2008-07-30T20:54:00.003-03:00</published><updated>2011-09-16T16:08:22.064-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oleg'/><category scheme='http://www.blogger.com/atom/ns#' term='Logic'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Curried Intuitions</title><summary type='text'>This is not a culinary but a logical exploration. There is continuous interest on the Curry-Howard correspondence not only from logicians but also from practicioners of typeful programming. I link just to the last two to appear on Reddit; as Baader-Meinhof would have it, I was reading the entry about the development of intuitionistic logic on the Stanford Encyclopedia of Philosophy when it </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/6455125937759010819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=6455125937759010819' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6455125937759010819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/6455125937759010819'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/07/curried-intuitions.html' title='Curried Intuitions'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7673710826400496272</id><published>2008-07-12T20:11:00.003-03:00</published><updated>2012-01-06T13:44:27.907-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>Picturing Networks</title><summary type='text'>This is what a sorting network looks like:



It is a sorting network of width 8 with a minimal number of 19 exchange boxes and 6 parallel stages. Each item to be sorted is represented by a horizontal line, and there are eight of them. Each exchange box is represented by a thicker vertical line between inputs. If the exchange boxes can be scheduled to run in parallel without interference, they </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7673710826400496272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7673710826400496272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7673710826400496272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7673710826400496272'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/07/picturing-networks.html' title='Picturing Networks'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_UyZUuTKh-wQ/SHk6a8d2SFI/AAAAAAAAAGQ/BvSO4qaBB20/s72-c/net_8_19_6.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-250421440817153863</id><published>2008-07-09T19:12:00.002-03:00</published><updated>2008-07-09T19:19:04.562-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Sorting out Sorters</title><summary type='text'>Previously I proved how the zero-one principle can test if a comparator network is actually a sorting network or not. This can be efficiently implemented as a program. I'll represent a comparator network of width w as an array of exchange boxes:


type network = (int * int) array


Each entry of the array is a pair (i, j) with 0 ≤ i ≤ j &lt; w, representing an exchange box between "wires" or indices</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/250421440817153863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=250421440817153863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/250421440817153863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/250421440817153863'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/07/sorting-out-sorters.html' title='Sorting out Sorters'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3748669776292236541</id><published>2008-07-09T14:08:00.002-03:00</published><updated>2008-07-09T19:26:00.717-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>The Zero-One Principle</title><summary type='text'>Continuing my treatment of comparator networks, I've experimenting with the discovery of minimal sorting networks using evolutionary programming, about which I plan to write in the future. One of the things needed for that is a means of quickly evaluating if a given network actually sorts all sequences of a given length or not. There is a very powerful theoretical result, called the zero-one </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3748669776292236541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3748669776292236541' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3748669776292236541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3748669776292236541'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/07/zero-one-principle.html' title='The Zero-One Principle'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1953465720744409128</id><published>2008-07-02T09:17:00.001-03:00</published><updated>2008-07-02T09:17:40.225-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Sorting out Sorting</title><summary type='text'>I believe that refactoring in the functional milieu is as important as it is in the object-oriented world. There's usually room for further improvement of one's definitions. Often, it is no more than the trivial application of selective inlining of definitions that clarify code that turned out more cluttered and opaque that it could have been, possibly from working at a remove from the problem </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1953465720744409128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1953465720744409128' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1953465720744409128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1953465720744409128'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/07/sorting-out-sorting_02.html' title='Sorting out Sorting'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3529671655362192218</id><published>2008-06-27T19:28:00.006-03:00</published><updated>2008-07-01T21:25:44.955-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Bitonic Sorting</title><summary type='text'>The riffle shuffle I've written about is not a mere card trick. It is a basic building block in the art of devising parallel networks for efficient use of SIMD computers. A typical application is the so-called bitonic sort. An elementary introduction to the algorithm with animations might make its working clear, but I find Knuth's exposition transparent:


Let us say that a sequence 〈z1, … zp〉 of</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3529671655362192218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3529671655362192218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3529671655362192218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3529671655362192218'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/bitonic-sorting.html' title='Bitonic Sorting'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-5320755895819162291</id><published>2008-06-25T22:37:00.002-03:00</published><updated>2008-06-27T19:27:55.576-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>The Riffle Shuffle</title><summary type='text'>Take a deck of cards. Split it into halves having the same number of cards each, and put them together so that the first card of the first half goes first, the first card of the second half goes second, the second card of the first half goes third; and so on interleaving cards from each half until your deck is put together back again. This operation is called the riffle shuffle.

It is easy to </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/5320755895819162291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=5320755895819162291' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/5320755895819162291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/5320755895819162291'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/riffle-shuffle.html' title='The Riffle Shuffle'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4739971778862440808</id><published>2008-06-16T20:45:00.005-03:00</published><updated>2008-06-16T21:44:08.381-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>When there's nothing on the other side</title><summary type='text'>Much has been written of how a Maybe monad translates cleanly into generic Java or C#. I have done so in this blog. The fact remains that, more often than not, it is not even necessary to wrap your code in a monad to avoid testing an object reference for null. There is a pattern language of object-oriented programming called null object. Whether it is well-known or not, I can't say; anecdotal </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4739971778862440808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4739971778862440808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4739971778862440808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4739971778862440808'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/when-theres-nothing-on-other-side.html' title='When there&apos;s nothing on the other side'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8006644330402543653</id><published>2008-06-09T23:27:00.005-03:00</published><updated>2008-12-09T16:48:33.724-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><title type='text'>Random Experiments</title><summary type='text'>I often find it is much more rewarding to tackle an algorithmic or mathematical problem from an experiential perspective rather than from a formal one. Trying to get some test data for an earlier program, I thought about a couple of ways of generating random increasing sequences.

Intent on generating n random points 0 = x0 ≤ x1 ≤ … ≤ xn-1 = 1 on the unit interval, I thought the most efficient </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8006644330402543653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8006644330402543653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8006644330402543653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8006644330402543653'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/random-experiments.html' title='Random Experiments'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_UyZUuTKh-wQ/SE3nOuxf1PI/AAAAAAAAAEg/pxgQdP7mScw/s72-c/monotone_3.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2291573987895385713</id><published>2008-06-06T12:56:00.001-03:00</published><updated>2009-07-28T15:43:25.593-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Monotone Cubic Interpolation</title><summary type='text'>(20090728 omission corrected.) The Wikipedia article on monotone cubic interpolation is, regrettably, not of very good quality. The idea is to precondition the derivatives (control points) for the cubic Hermite splines interpolating a monotonic data set so that the resulting piecewise cubic is also monotonic. The algorithm given is extracted from a paper which is not publicly available online. </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2291573987895385713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2291573987895385713' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2291573987895385713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2291573987895385713'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/monotone-cubic-interpolation.html' title='Monotone Cubic Interpolation'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-3700826585192750839</id><published>2008-06-05T10:49:00.002-03:00</published><updated>2009-01-05T13:34:14.492-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><title type='text'>A Circular Triviality</title><summary type='text'>(Minor corrections) This is my own take at the corollary to the Intermediate Value theorem on the unit circle. It is not substantially different to the proof linked to, so its value is zero everywhere (maybe except for a countable subset). In particular, this is a special case of the much more general Borsuk-Ulam theorem.

Consider f a continuous function with domain on the unit circle. Then </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/3700826585192750839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=3700826585192750839' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3700826585192750839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/3700826585192750839'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/06/circular-triviality.html' title='A Circular Triviality'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1633407251045816558</id><published>2008-05-04T10:40:00.000-03:00</published><updated>2011-09-09T12:01:54.125-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='Meta'/><title type='text'>Romantic, or Enlightened?</title><summary type='text'>It is not much of a confession to say that I'm of a rather dogmatic disposition regarding the need for strict, clear and unambiguous formalisms —let this serve— in the endeavors of formal thought. Mathematics are a testament to this, but, somewhat inexplicably, no other human science has gone as far. Computer Science, its little sibling, should have been expected to follow its steps; instead, it </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1633407251045816558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1633407251045816558' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1633407251045816558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1633407251045816558'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/05/romantic-or-enlightened.html' title='Romantic, or Enlightened?'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-7843320753843838279</id><published>2008-04-11T00:32:00.001-03:00</published><updated>2008-04-11T20:11:10.781-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Fixnum Figurations</title><summary type='text'>The polytopic numbers P.k.n are a kind of figurate numbers giving the number of lattice points on a k-dimensional simplex (a right triangle, tetrahedron, …) x0 + x1 + … + xk-1 ≤ n of integer side n. For k = 2 we have the Pythagorean triangular numbers 1, 3, 6, 10…, the last one called the tetractys. In general, the way to calculate P.k.n is to stack n simplices of dimension k - 1 with decreasing </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/7843320753843838279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=7843320753843838279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7843320753843838279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/7843320753843838279'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/04/fixnum-figurations.html' title='Fixnum Figurations'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-100261392379975917</id><published>2008-03-29T11:04:00.005-03:00</published><updated>2011-09-16T16:05:33.079-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Types'/><category scheme='http://www.blogger.com/atom/ns#' term='Oleg'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><title type='text'>OCaml and typeful programming: an annotated bibliography (of sorts)</title><summary type='text'>I cannot help but feel somewhat envious at the high level of expertise that the Haskell community display at effectively using the advanced type system the language provides. Many of the techniques are not applicable to OCaml, which lacks higher-ranked polymorphism. Some of these techniques, however, can be translated to OCaml, but these seem to be more folklore than codified practice, and </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/100261392379975917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=100261392379975917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/100261392379975917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/100261392379975917'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/ocaml-and-typeful-programming-annotated.html' title='OCaml and typeful programming: an annotated bibliography (of sorts)'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8488208991411344439</id><published>2008-03-20T21:47:00.004-03:00</published><updated>2011-09-29T11:52:05.047-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Splitting Hairs</title><summary type='text'>It is often claimed that the formal derivation of an algorithm hand-in-hand with its specification is too hard to do, so that it is only viable for toy examples. I have found, as Dijkstra repeatedly has, that discipline and restraint in the drive to "just code" are key to succeeding. As an example, I'll show the creation from scratch of a program I didn't know before.Aside: You'll have to believe</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8488208991411344439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8488208991411344439' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8488208991411344439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8488208991411344439'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/splitting-hairs.html' title='Splitting Hairs'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-1844610241787436412</id><published>2008-03-19T10:53:00.002-03:00</published><updated>2008-03-19T10:55:07.244-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Generating Combinations</title><summary type='text'>Only for the record, and because I arrived at this form of the algorithm after massaging the one given in Algorithms for Programmers, Algorithm 6.1 "Lexicographic and Co-Lexicographic Order" and I find it very pretty. First the algorithm, then the explanation:


let iter_comb n k (f : int array -&gt; unit) =
  let v = Array.init k (fun i -&gt; i) in
  f v;
  while v.(0) != n - k do
    let j = ref (k -</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/1844610241787436412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=1844610241787436412' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1844610241787436412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/1844610241787436412'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/generating-combinations.html' title='Generating Combinations'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4383837091543727487</id><published>2008-03-13T21:33:00.005-02:00</published><updated>2008-12-09T16:48:34.138-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Bitwise Dice</title><summary type='text'>I'm rereading this paper by Knuth and Yao [1], which could be called "How to throw a die when all you have is a penny", or something. Its premise is, how can you generate a random variable with arbitrary distribution when all you have is a perfectly fair binary random variate? It begins with this blindingly eye-catching diagram:




Every round node is a coin-toss (a bit-flip), and transitions </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4383837091543727487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4383837091543727487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4383837091543727487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4383837091543727487'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/bitwise-dice.html' title='Bitwise Dice'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/R9m5_aG9YWI/AAAAAAAAAEQ/tClAjCsfPF0/s72-c/die_1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-2903763202615696812</id><published>2008-03-09T21:38:00.000-02:00</published><updated>2008-03-09T21:39:29.527-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Thinking Inside the Box</title><summary type='text'>There's a non-trivial algorithm in Computer Graphics, the so-called Kay-Kajiya test, that is actually trivial to derive by carefully thinking about the problem it solves. A axis-aligned box is the 3-dimensional generalization of a closed interval. Intuitively, it's a rectangular box whose six sides are parallel to the three axes; formally, given points P = (px, py, pz) and Q = (qx, qy, qz), it is</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/2903763202615696812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=2903763202615696812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2903763202615696812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/2903763202615696812'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/thinking-inside-box.html' title='Thinking Inside the Box'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-8665270731108034228</id><published>2008-03-06T00:15:00.005-02:00</published><updated>2012-01-06T13:44:27.919-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>The Castle of Glyphs</title><summary type='text'>Well, in English they're not called castles, but rooks. Surprisingly, the castling move is called enroque in Spanish, which is cognate to rook. Suppose you want to find non-self-intersecting closed rook's tours on a m-by-n chessboard. How would you go about it? But first, why would you want to do that?

I've found they make pretty linear patterns, somewhat reminiscent of arabesques and square </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/8665270731108034228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=8665270731108034228' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8665270731108034228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/8665270731108034228'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/castle-of-glyphs.html' title='The Castle of Glyphs'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_UyZUuTKh-wQ/R89UNId4ZKI/AAAAAAAAAD4/oWAZBpmuOJ0/s72-c/rook4x4.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-9094001941766345947</id><published>2008-03-03T21:33:00.002-02:00</published><updated>2010-08-05T14:08:26.572-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>ocamlsdl on MacOS X 10.5 "Leopard"</title><summary type='text'>I've found that there a number of pitfalls that make getting ocamlsdl up and running on Leopard a less than straightforward experience. For the record, here are a number of fixes I found I needed to apply. I'm reconstructing the process after the fact, so I apologize if anything is missing.

0. Prepare your environment

You'll need to set up some environment variables first. I'm a tcsh user, </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/9094001941766345947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=9094001941766345947' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/9094001941766345947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/9094001941766345947'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/03/ocamlsdl-on-macos-x-105-leopard.html' title='ocamlsdl on MacOS X 10.5 &quot;Leopard&quot;'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-308765061711621148</id><published>2008-02-27T19:51:00.000-02:00</published><updated>2008-02-27T19:53:55.504-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>The (square) root of refinement</title><summary type='text'>There's this great little book, A Method of Programming by Edsger W. Dijkstra and Wim Feijen, which is dry and precise as a smack of a ruler against collected fingertips. Really, I cannot recommend it highly enough. It includes a little essay, Coordinate transformation that —for me— illustrates beautifully the methodical, stepwise refining of a program by meaning-preserving transformations.

They</summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/308765061711621148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=308765061711621148' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/308765061711621148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/308765061711621148'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/02/square-root-of-refinement.html' title='The (square) root of refinement'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5888658295182480819.post-4850353250405095781</id><published>2008-02-26T17:11:00.000-02:00</published><updated>2008-02-26T17:12:05.957-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCaml'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>Pass the Bucket</title><summary type='text'>Although not without its problems, hash tables are a popular data structure for storage and retrieval of key/value pairs, otherwise known as finite maps or finite functions. It is the main data structure in dynamic languages like JavaScript, AWK, Arc, Io, Python, Perl and others. To recapitulate, the idea behind a hash table is to store data in an array (which is a finite map with domain a </summary><link rel='replies' type='application/atom+xml' href='http://alaska-kamtchatka.blogspot.com/feeds/4850353250405095781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5888658295182480819&amp;postID=4850353250405095781' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4850353250405095781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5888658295182480819/posts/default/4850353250405095781'/><link rel='alternate' type='text/html' href='http://alaska-kamtchatka.blogspot.com/2008/02/pass-bucket.html' title='Pass the Bucket'/><author><name>Matías Giovannini</name><uri>http://www.blogger.com/profile/17772004856076119446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/-GuZf5MQHutA/Twr58Dfff1I/AAAAAAAAARs/hyTScQg2tTg/s220/avatar.jpg'/></author><thr:total>1</thr:total></entry></feed>
