Date: 12 Dec 2002 08:49:36 -0000 Message-ID: <20021212084936.29731.qmail@plover.com> To: mjd-book@plover.com Subject: Mark Dominus book news: Chapter V ready Organization: Plover Systems From: Mark Jason Dominus If you forgot what this list is about, or you don't know why you're getting this message, please see http://perl.plover.com/book/ To unsubscribe, send a blank message to mjd-book-unsubscribe@plover.com. ---------------------------------------------------------------- This has been a much longer delay than I expected. When I promised a low-volume mailing list, I did not expect it to be quite as low volume as it has been. However, I hope to be sending updates more frequently in the coming months, and to have the draft of the entire book finished in February. If I can meet this deadline, the book should be available by the time of the Perl conference in July. The delay on Chapter V was caused by three things. First, I became severely depressed; I'm now taking antidepression medicine, which seems to be working. Second, my wife and I bought a new house in Philadelphia and moved into it in September. And third, one of the sections I was working on for Chapter V just kept getting harder and harder and taking more and more time. Finally I dumped it. I hope it will get back into the draft later on. Chapter V was not in my original outline. It's about how to convert expensive recursive functions to iterators and elimination of recursion generally. As most of you probably know, Chapter IV, about iterators, turned out to be very big. When I got to the end, I found that I had still more to say---when I started writing it, I thought that it was difficult in general to construct an iterator replacement for an arbitrary recursive function. As I wrote the chapter, I discovered that this wasn't so; there was a general method for doing the conversion. The first half of the present Chapter V discusses this in detail. The last half is about tail call elimination, tail call recursion, and methods for getting rid of recursive calls. In the middle there used to be an extended example about the 'kerning pairs' problem. Here's an explanation of the problem: Another problem my font designer friend Hoefler has is related to 'kerning pairs'. A well-designed computer font is equipped with a table that gives the 'kerning distances' for each pair of letters or other symbols The kerning distance says how much space to remove when the two letters appear next to each other. Kerning prevents large white gaps from appearing when two letters that don't fit well, such as capital 'T' and lowercase 'o' appear next to each other. When 'T' and 'o' are properly typeset, the 'o' is moved a little to the left, to tuck it under the crossbar of the 'T'. Hoefler's company prints a font specimen catalog every few months, giving examples of all his fonts. One thing he'd like to demonstrate is how well the letters kern. He'd like to have an example of every one of the 676 pairs of lowercase letters, starting with 'aa' and ending with 'zz'. But he doesn't want to just list 676 pairs of letters; instead, he wants to give example words that contain the kerning pairs. He has a dictionary of 676 words from 'bazaar' to 'puzzle', one for each pair of letters, but space is limited in the catalog, and the dictionary is redundant. After you've included 'bazaar' in your catalog, you not only have an example of 'aa', but also 'ba', 'az', 'za', and 'ar' as well, so there's no point to including 'lambada', 'magazine', 'organization', or 'share', unless you happen to need one of them to cover some other pair. Hoefler's problem: What's the minimum set of dictionary words that covers every one of the 676 letter pairs, also called 'digraphs'? Clearly, generating and testing every possible dictionary is absurd. But a directed search works well. ... I started to turn this section into a grab bag of every technique I could think of that might be useful for squeezing better performance out of an iterator. And that's where my problems came from. First I wrote seven or eight different versions of the program to solve this problem, and then found that I couldn't keep them straight. Then I wrote a program to generate 128 different versions of the program (with every possible combination of seven different design decisions) and discovered that the result data was too large for me to see at a glance what was working and what wasn't, or what order to discuss the design decisions in. So I wrote programs to analyze the results of the 128 programs. Then I found that 32 of them had a bug, and when I fixed it I found that actually none of the programs were finding very good solutions. At this point I have results from 2,048 versions of the program (!!) and I need to analyze and write up the results. Probably most of the writeup will be quick, since I can cannibalize big chunks of the ten or fifteen pages I have already written about it. But the analysis is taking a long time. I have to make progress on the book, so I am putting the kerning pairs thing aside for the time being. I hope to get it back in eventually. In the meantime, Chapter V is still pretty good, although to me it feels like there is a big hole in it. If you would like to take a look, a plain text draft is available at and an HTML version at [ Sorry, freebies are available only to mailing list subscribers. Send mail to mjd-book-subscribe@plover.com to subscribe. ] I would be grateful for any and all corrections. I'd like to remind you that you absolutely must not distribute this to anyone else, and in fact I'd prefer it if you didn't even download a permanent copy to your computer. Why? Because when the book is finally published, I will be very unhappy if crappy old drafts are circulating on the Internet. If the drafts started circulating, I would have to stop making them available. That would be a shame, because I like sharing the drafts. It might be tempting to save a copy, because you probably are thinking that you don't know how long the file will be around. But there's no point to doing this. Once the book is published, the complete, revised, corrected version will be available on my web site for free, so you will have no use for the old draft copies. Please make me happy and repay my trust by not copying or distributing the drafts. Also, please do not advertise the draft URL to other people. I want the drafts to be a special present for the people on my mailing list. But please do advertise the mailing list to other people. I will be very happy if more people join the mailing list. To subscribe, send email to mjd-book-subscribe@plover.com. I will send another message next time something happens. Last time I sent a message, I said "I hope the wait will not be as long as last time." and then it was fourteen months. This time it will not be as long as fourteen months. I am trying to finished Chapter VI by next Friday. (December 20.) Thank you all for your interest.