A Little Politics, a Little History
Mike Littwin had a great column in the Rocky Mountain News on Saturday; he starts out by relating a story of an irate email written in response to a column he wrote:
What it came down to - it is so obvious - was this: The reader didn't believe that I believed what I was saying.
That pretty much sums up the problem with political discourse in America these days, not that people don't have a voice, but that they refuse to give any credence to alternate views. At best, anyone holding that view is sadly deluded, and it goes downhill from there:
The charge is at the very heart of the nation's red-blue divide - which, depending on your reading, is either a grass-roots culture war, an invention of the liberal political class, all Rush Limbaugh's fault or not really a war at all. In any case, it's a divide that has left us a 48-48 country with so few undecideds that the pollsters know them, and their children, by name.
Mike's writing a series expanding on this theme this week.
Lately, I've been reading a lot of Civil War history. It's striking the way political discourse broke down is the years leading up to the Civil War. One other thing I noticed is that the 8 Presidents leading up to the war (from 1837 - 1861) were one term Presidents (if they completed their term, several died in office). Lincoln was the first President re-elected to the post. There were other factors, to be sure (i.e. the economy), but it's one example of the turmoil leading up to the war.
— Gordon Weakliem at permanent link
Match Magic
I've been more interested in doing work in CL lately, but I'm so in love with match syntax that I'm having a hard time making the switch. Today, I put together a program to generate an RSS feed from Richard Thompson's upcoming tour dates page in PLT Scheme. It's remarkable how you can use match to tear apart HTML pages. Using the definition of sxml->links from the Scheme cookbook, the following will extract tour date info from the page (assuming you've converted the contents to SXML, using HtmlPrag). Essentially, this page is a table where each row is a tour date, so the trick is simply to tear it into rows and extract the data you want from each <td>. This definition is awfully fragile; I'm sure it could be made more robust, but I honestly don't fully understand everything you can do with match. Sometimes, match just turns into black magic for me.
(define (sxml->tour-dates sxml)
(let loop ([sxml sxml]
[tour-dates '()]
(date-info '()))
(match sxml
[('td ('@ ('valign "top") ('class "tablecontent"))
phone ('br) "\r\n" . link )
(cons phone (sxml->links link))]
[('td ('@ ('valign "top") ('class "tablecontent"))
('nobr day ('*ENTITY* _ ...) mo ('*ENTITY* _ ...) yr))
(cons (format "~A ~A ~A" day mo yr) date-info)]
[('td ('@ ('valign "top") ('class "tablecontent")) info)
(cons info date-info)]
[('tr ('@ ('bgcolor _)) . more)
(cons (append date-info
(apply append
(map sxml->tour-dates sxml))) tour-dates)]
[(item ...)
(append tour-dates
(apply append
(map sxml->tour-dates sxml)))]
[else
tour-dates])))
Today, I saw that Franz announced, then pulled, Allegro Prolog, an implementation of Prolog within Allegro CL, based upon Peter Norvig's version in PAIP. It seems like you could hadle matching via a Prolog system, but I don't