Updated 2016-01-17 04:57:23 by pooryorick

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 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 2004-09: 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 didn't use base 60 for large sums of money, like we are used to using with seconds and minutes?

Farthings were discontinued in 1961 as almost nothing cost that little (except chews, a sweet, two for a halfpenny).

In Victorian times (BM - before Me) we also had coins called groats (worth 4d, 3 groats made 1s) but these never made it into the currency units. Similarly pre-decimalisation we had half crowns (2s 6d = 1/8 of a pound), florins (2s, 1/10 pound), tanners (6d, half shilling) and the threepenny bit - a rather odd dodecagonal brass coin worth 3d). Crowns (5s) were issued for special occasions (Churchill's funeral I remember). Now we issue special 50p coins (recently NHS 50 years, EU expansion, Scottish parliament and others) look out for them when in UK.

Talking of absurd units, how about: 12 inch=1 foot, 3 feet = 1 yard, 22 Yards=1 chain, 10 chain=1 furlong, 8 furlongs = 1 mile etc (see http://www.electro-optical.com/unitconv/unitdict/meas_sys.htm). Still used in the USA!

In GB of course we have gone metric, we buy wood in metres and carpet in square metres. Except for: distances on motorways & roadsigns, speed limits, readings on speedometers etc.

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 sort.uk.phone {x y} {
    foreach i {x y} {
        regsub {Ma?c ?([A-Z])} [set  $i] {M_\1} $i
    string compare $x $y
% lsort -command sort.uk.phone {MacDonald McArthur McEwan Lyttle Mabbs Jones}
Jones Lyttle McArthur MacDonald McEwan Mabbs

GWM: I have a copy of the 2003-2004 Merton (South West London) Phone Book in front of me and Mabbs would precede McArthur and MacArthur. (Certainly Mabin and Maby do). There is a note in the directory that "m' Mc & Mac are treated as Mac & the next letter in the name determines position of the entry. Similarly names such as Mace and Mack the fourth letter determines their position.". The entries near Mace are: MacDougall, Mace, McElhinney, McElroy, McEnery, Macer.... I hope this doesn't break your sorting code!

KBK 2001-02-14: lsort -command is a pig from the performance standpoint. Much faster, although treble the memory consumption, is:
proc sort.uk.phone2 { 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

sort.uk.phone2 {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.

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

See Also  edit

English plurals
English number reader