Archive for July, 2008

On the Use of non-Tail-Recursive Functions In Commercial Code

Thursday, July 24th, 2008

Dear Customer,

Attached is the software for which you paid several hundred pounds. It should work. Maybe on larger inputs it will fail. Sometimes several small parts of it will work, but when you put them together it will fail.

You see, there’s a maximum input data size for which it works. I don’t know exactly what that is, and it may vary according to your platform, configuration, or the day of the week.

On some platforms it might fail cleanly, on some it might segfault. We’re not sure.

(Our codebase is entirely tail-recursive, but people I’ve mentioned this to in passing seem to consider this an extreme position, citing loss of speed. Really?)

New Reviews of Old Books #57

Friday, July 11th, 2008

Digital Typography, Donald E. Knuth, 1999 (Amazon)

Digital Typography Book Front Cover

This collection of more than thirty articles and notes covering the Knuth’s foray into digital type in the late seventies and eighties. They range from font design (a whole chapter on the shape of the letter S), to the history of typography, to some TeX related material (the entire exposition of TeX’s line-breaking algorithm, for instance). There is also plently of the concrete mathematical analysis associated with Knuth, including a piece explaining why arrowheads plotted on bitmap displays can look asymmetrical even at quite high resolutions.

Perhaps the most appealing of the less-technical articles is Chapter 17 (AMS Euler), which describes the collaboration between Knuth and Herman Zapf to produce a new maths font for the American Mathematical Society. It’s drawn directly from the correspondence between the two as the maths of MetaFont progresses along with the design of the font itself.

The book is, as you would expect, beautifully typeset and bound. It costs about sixteen pounds. 

Compiling Code Under OCaml and F# (Part Two)

Friday, July 4th, 2008

[Part One]

Twenty thousand lines of CamlPDF and cpdf later, here are some numbers:

  • Occasions on which conditional compilation is required: 22
  • Compilation warnings with fsc –no-warn 62: 15
  • Time taken: 22 hours

The current executable appears to be about 8 times slower than OCaml native compilation, but I haven’t examined this enough to know how much we might be able to improve upon it.

I’m planning to clean up the code to see how much of the conditional compilation we can get into a single Utility module.

What’s next is to repackage the command line tools as an API for .NET users. I know very little about this topic, so it’s going to require quite a bit of effort before I’m willing to put it on sale and support it.

If you’re familiar with packaging up libraries for .NET and would like to beta test, drop me a line in the comments, or via our website.