All / Technology & Society


I went to a céilidh recently. In contemporary terminology, a céilidh is a gathering for people wishing to partake in traditional Scottish dancing (or Irish, if spelled céilí). However, I am told by Wikipedia that the term originally referred to any kind of social gathering, not necessarily involving dancing. There’s a parallel in belly dance (my specialist subject): among the global belly dance community the Arabic word hafla has come to mean a sort of dance recital or informal gathering to watch dance, but in Arabic it just means any kind of party.

So there we all were, dutifully following the instructions of the caller, do-si-doing, swinging our partners ’round and ’round, promenading, and so forth, when it occurred to me that this type of dancing is a form of algorithm. I recalled my first computer science class, in which algorithms were described as “step-by-step procedures for accomplishing tasks formalized into very precise, atomic (indivisible) instructions. An algorithm should allow for a task to be accomplished by someone who or something that does not even understand the task.”

Well, I will not deny that there were many experienced hands at this particular céilidh: tartan abounded. There were sporrans. There was whiskey. But you cannot have a truly good céilidh unless there are several people there who have no idea what they’re doing and to that end, several of us definitely did not even understand the task. But fortune smiled upon us, and the caller at one point gave us these instructions (in a thick Scottish accent), which helped us attain remarkable clarity: “If you fear for your safety,” said she, “you know you’re doing it right.”

You could argue that these patterns are not algorithmic because at the end you get the same output that you put in: usually at the end of any kind of large group dance with a series of iterating steps, the patterns simply repeat until you all end up in the same position where you started (depending on the size of the group, of course.) What kind of result is that? However, an algorithm doesn’t specify that its output must be sensible, or useful. Sometimes it can just be a bit of fun. And I think one of the best tests for “Is this an algorithm?” is: if you mess up the instructions even slightly, is there the potential for things to go horribly, disastrously, hilariously, and possibly injuriously wrong? If the answer is yes, you’ve almost certainly got an algorithm on your hands. Think about that next time you’re assembling some flat-pack furniture. (Also if you find the instructions can be abbreviated because there are fundamental basic steps that frequently recur, probably an algorithm. For example, crochet and knitting patterns will look like gibberish to you if you don’t know what common abbreviations mean. Similarly, céilidh calling instructions will appear to be an eldritch incantation unless you know what some of these terms are.)

Our major wrong moment came in a dance called Strip the Willow. (We were doing the Orcadian, or Shetland, version, in case anyone is interested.) It’s a relatively simple dance: you and your partner spin around like mad for sixteen bars, then you hook arms and swing around with the next person in line, then your partner, then the next person in line, then your partner, until you reach all the way to the end of the line. Very little risk of losing an eye in this one, as long as you keep going in the right direction. The main trick is that as the couples progress down the line, the lines themselves need to remember to keep shuffling up the hall, otherwise you end up with a céilidh Stack Overflow problem (too many people at the end of the line!) However, this was not the problem that we had. Instead, at some point during the dance somebody got confused. The result was that we got out of sync and suddenly nobody knew whose partner was whose anymore. Plus one partner would be swinging the person about three couples ahead of the other partner as they worked down the line, with a lot of comical running back and forth to meet in the middle. Luckily the céilidh crowd are usually a pretty good-natured crowd and inclined to dance with anybody that happens to be in their general vicinity. We should have been able to sort it out pretty quickly, but once we got out of sync at least one person panicked and, instead of dancing down the row just stood there very much like a deer in headlights. Kind-intentioned (or mostly so, anyway) hands reached out and prodded this person into the swing of things but by then we were a Willow beyond repair. At that point there was nothing to do but laugh and try not to accidentally smack anybody in the face while racing from person to person.

In the end there were no serious injuries, though I spent several days with sore ribs from laughing so hard. If you can think of a more fun algorithm than that, I would love to hear about it.