I’m gonna be (D miles)

As Merlin Mann and John Gruber talked about Roman numerals on the latest episode of The Talk Show, three thoughts went through my mind:

  1. I’ve never been able to remember the Roman numerals for 50 and 500. I know they’re L and D, but I can’t keep track of which is which. Next season, the NFL will be heading toward Super Bowl L, so maybe that’ll help me remember.
  2. Although IV is the standard for 4, IIII can be and is used, which should make Merlin feel better. The Wikipedia article on Roman numerals shows examples and says IIII may actually have been more common in Roman times. If Merlin wants to use IIII, he can just claim to be harkening back to an earlier tradition.
  3. Common Lisp has a built-in way to generate Roman numerals from Arabic using the format function. This is an example of how Common Lisp is even more of a kitchen-sink language than Perl is.

(An additional thought I just had: Markdown doesn’t let you specify Roman numerals for ordered lists unless you drop down into HTML. This calls for a new standard!)

Common Lisp’s format function, like C’s printf, uses a format string to specify how numbers and strings are to be printed out. And as with printf, the syntax of the format string is terse and difficult to remember without frequent use.

The ~R radix control is the wackiest of the format control directives. Used by itself, it generates a string of English words for the number. Here’s an excerpt from an interactive CLISP session:

[1]> (format nil "~R" 99)
"ninety-nine"

Used with a colon, we get an ordinal version of the number:

[2]> (format nil "~:R" 99)
"ninety-ninth"

Used with an at sign, we get a standard Roman numeral:

[3]> (format nil "~@R" 99)
"XCIX"

Used with both the colon and the at sign, we get a variant Roman numeral:

[4]> (format nil "~:@R" 99)
"LXXXXVIIII"

I’m not surprised Common Lisp has this capability, but I am surprised it’s in the language itself. You’d think something this odd would be in a fun but seldom used library.

Speaking of odd and fun:

Update 11/11/14
In an email, Bader Alabbasi tells me of a mnemonic he learned in school for the order of the Roman numerals for 50, 100, 500, and 1000: Lazy Centurians Dislike Marching.