Version 14 of Things British

Updated 2004-09-24 09:52:02

Richard Suchenwirth - This is not another OO game, just some Tcl notes for peculiarities of the United Kingdom. Tcl/Tk code to draw the Union Jack on a canvas can be had at Describing and rendering flags in Tcl.

Non-decimal money: Kevin Kenny (2 November 2000) At least we seldom have to deal with mixed radix currencies any more; dealing with pounds-shillings-pence was quite an ��£sd trip.

 ��£2 16s 2 3/4d

was read as "two pounds, sixteen shillings tuppence ha'penny farthing").

Steve Blinkhorn: Of no programming relevance whatsoever - no it wasn't. "Two pounds sixteen and tuppence three-farthings" was what we used to say. Or often, for sums of money that amounted to less than five pounds (books were a typical example), only shillings and pence were counted: ��£1/15/- (the dash meant no pence) was often rendered as 35/-, "thirty-five shillings" or more colloquially "thirty-five bob". ��£1/19/6 ("one pound nineteen and six") would be "thirty-nine and six", and ��£1/19/11 "thirty-nine and eleven", allegedly popular price points because they forced sales assistants to to work the till ("cash register") as a theft preventative measure.

There was, at the time of the introduction of decimal currency in the UK in 1971, a wonderfully mock-erudite study of the sociological and social anthropological study of the retiring currency system, pointing out that pence, shillings, pounds and guineas (a guinea was ��£1/1/-, still used I believe as the unit of bidding in racehorse auctions) were the units of choice of workmen, merchants, professionals and aristocrats respectively.

GWM(Sep 2004) Actually, old bean, we used to say "tuppence three farthings" at least in Southern England. And we had to learn how to do multiplication of these sums in our heads for example "I buy 7 LPs at ��£1 6s 2 3/4d how much change do I get from a ��£10 pound note?" => ��£10 - ��£9 3s 7 1/4d => 16s 4 3/4d, yes I did that in my head just now (but I have rechecked it in Excel)- how our heads remain filled with useless knowledge. It is quite easy really - just remember that farthings are in base 4, pence are in base 12, shillings base 20. I wonder why we didnt use base 60 for large sums of money, like we are used to using with seconds and minutes?

--- RS: Except for fractions of old pence, the following converts decimal GBP amounts to L-s-d, and Unicoded:

 proc dec2trad {amount {slash " "}} {
        set L [expr int($amount)]
        set s [expr int(($amount-$L)*20)]
        set d [expr int(($amount-$L-$s/20.)*240+0.5)]
        set res ""
        if {$slash==" "} {
                if $L {append res "\u20A4$L"}
                if $s {append res " ${s}s"}
                if $d {append res " ${d}d"}
        } else {
                if $L {append res "\u20A4$L/"}
                if $s {append res $s} else {append res -}
                if $d {append res /$d} else {append res /-}
        set res
 dec2trad 10.01 /
 dec2trad .10 /

UK phone-book sorting order: Donal Fellows wrote in comp.lang.tcl: Indeed, even for strings there are many different ordering relations. Tcl supports two directly in [lsort]: ASCII and Dictionary. There are others though; dictionary ordering should be dependent on locale, and there are also other orderings like phone-book ordering (in the UK, MacDonald should come between McArthur and McEwan in phone number listings, and all should precede Mabbs.)

 proc {x y} {
        foreach i {x y} {
            regsub {Ma?c ?([A-Z])} [set  $i] {M_\1} $i
        string compare $x $y
 lsort -command {MacDonald McArthur McEwan Lyttle Mabbs Jones}
 Jones Lyttle McArthur MacDonald McEwan Mabbs

KBK (14 February 2001) -- [lsort -command] is a pig from the performance standpoint. Much faster, although treble the memory consumption, is:

 proc { list } {
    foreach name $list {
        regsub {Ma?c ?([A-Z])} $name {M_\1} key
        lappend list2 [list $key $name]
    foreach pair [lsort -index 0 -ascii $list2] {
        lappend list3 [lindex $pair 1]
    return $list3
 } {MacDonald McArthur McEwan Lyttle Mabbs Jones}

For virtually all applications, this technique of ``sort a list of pairs'' should be preferred to [lsort -command]. See Custom sorting.

There's a benchmark of the two versions of the command over on the lsort page.

English plurals - English number reader

Category Local | Things German | Things Japanese | Arts and crafts of Tcl-Tk programming

I mark-up printouts of code with a pre-war Conway Stewart 475. Does that count? -pse