The last payment on my student loan has gone to the IRD.
Time to buy a house.
The last payment on my student loan has gone to the IRD.
Time to buy a house.
We’re experimenting with recording some of our favourite rembetiko numbers. Here is our rendition of Τα λευτά σου δεν τα θέλω (“I don’t want your money”), with Olga’s vocals and bouzouki and me on guitar. It’s by Toundas, our favourite rebetis; the original was sung by Rosa Eskanazy.
Every time I visit Germany by train, something goes wrong.
Once I spent most of the day waiting on platforms, after some perfect-storm-like sequence of feedback effects interrupted not just the service I had a ticket for but also the fallback service we were advised to take instead, and then even the unscheduled service arranged specifically for the victims of the outage.
Another time, more pleasantly, I had an unscheduled wait of a couple of hours in Cologne: just long enough for an old friend to take the subway into town and have a beer with me.
Recently I visited the same friend for a weekend; predictably, something went wrong on the way home. This time it was only a communications breakdown, but one I found particularly amusing: the various automated systems announcing the timetables completely failed to cope with a planned change to the schedule.
The ticket I paid for was Cologne to Amsterdam, but my seat reservation was only valid to Utrecht; the reservation system, at any rate, knew that on the day I was travelling the international service to Amsterdam would end instead at Utrecht, and the last half-hour of the trip would have to be made on local trains.
In Cologne, an automated voice helpfully announced in three languages: “The ICE service to Utrecht leaving platform 5 at 17:32 will not stop in Utrecht.” (We’ll carry on until we fall off the edge of the world?) The board on platform 5 announced an ICE service to Amsterdam, and warned that it would not be stopping in Utrecht. (Not to the edge of the world then. I wonder what my seat reservation to Utrecht is worth if we don’t stop there?) On the train, around the time I would have expected to arrive in Utrecht (or not to arrive there, under the circumstances) the wee lighted displays said we were approaching Arnhem. (I wondered how far from Arnhem to Amsterdam and what time I would be getting home.) Then we pulled in to Utrecht: right on time, as predicted on my ticket, but somewhat befuddled.
We’re off to New Zealand for a much-needed dose of summer. We’ll be back the first week of January. If you happen to be in that hemisphere, look us up in Golden Bay; we’ll be staying with my folks, under Leetch and Pemberton in the phonebook.
We’ll be pretty internet-deprived (not that that’s a bad thing); last I checked my folks were on dial-up, and the only place I got mobile reception on my last trip home was on top of a hill it almost killed me to climb (it wasn’t worth it for the reception; the view was pretty neat though). I’ve scheduled a few posts so the tumbleweeds don’t pile up too high, but it’s going to be even quieter than usual around here.
Recently in code review Boaz questioned my choice of the order of arguments in a function definition. I couldn’t come up with a coherent reason for my choice, and he couldn’t put words to his feeling that it was odd. As often happens, I realised what was going on while doing something entirely non-coding-related; this time I was in the shower when the light dawned. It turns out that the argument order tells you something about the language paradigm I’m thinking in (OO versus functional); it also ties in to the choice between destructive updates or returning a modified copy, which came up in the same code review.
The function definition (in Python) looks something like this:
def remove_brands_from_chart_defn(chart_defn, brands_to_remove):
A chart definition is a complex structure of nested dictionaries and lists (it comes from JSON serialisation of a JavaScript object in the browser); a brand is an element that can occur in many places in a chart definition, so the function has to make a recursive traversal of the chart definition’s structure to find all occurrences of the brands it has to remove.
Now there are two ways of thinking about this process, which correspond to the two possible orderings of the function arguments. One is that a chart definition is an object, which has the behaviour “remove these brands from my internal structure”. This would correspond more directly to the Python definition:
class ChartDefinition(object): def remove_brands(self, brands_to_remove):
As it happens, the chart definition is simply a Python dictionary read from a JSON string, so we don’t have a class to define this method on. (Some considerations I’ll get to later suggest that we ought to have one, but I’ll leave that aside for the moment.) You can see the object-oriented argument pattern though: the first argument gives the object being operated on (which languages like Java make entirely implicit in a method’s argument structure) while the rest of the arguments specify the particular form the operation will take (which brands get removed, in this case).
The other argument ordering is much more reminiscent of functional programming. Here “removing brands X and Y” is a specific form of a more general operation “removing brands”, and the specialised form gets applied to a particular data structure. Haskell makes this very explicit with its syntactic support for currying:
remove_brands :: [Brand] -> ChartDefn -> ChartDefn remove_brands_X_and_Y = remove_brands [brand_x, brand_y]
Here remove_brands_X_and_Y is now a one-argument function that wants a chart definition, and will perform the brand-removal operation on it. (Of course you could also think of the operation as “remove brands from chart definition X”, and depending on your use case that might be the more useful currying to apply, but that perspective is (perhaps) less functional and (definitely) more object-oriented.)
So my choice of argument order reveals some aspects of my coding psychology: in this case, at least, it seems I was “thinking OO” even when I wasn’t using Python’s class system at all. And indeed, the issue of destructive updates versus return-modified-copy bears this out.
Remember that a chart definition is a complex structure of nested dictionaries and lists, and that the brands to be removed can occur at many different positions in this structure. Of course I handled the removal with a recursive traversal of the structure, but given this there are still two ways to get the resulting chart definition back: I could modify the structure in-place (“destructive update”) or I could return a copy of the structure with the modifications occurring only in the copy (“return-modified-copy”).1
How to choose between the two? Of course, the particular situation might make one or other choice obvious. (For instance, it’s elsewhere very handy for us to be able to extract by reference a list of brands occurring in a chart definition, so that altering those brands destructively updates the chart as well.) But the language paradigm can also help with making this decision.
The destructive update is very natural in the OO setting: one of the behaviours of objects of this type is to update their internal state by removing internal references to a given list of brands. Thinking functionally, on the other hand, the destructive side effect is unexpected and unnecessary, while return-modified-copy is much more natural.
The odd thing about this situation is that because our chart definition is not an object (at least not of a user-defined type), I had written an OO-like function to perform a destructive update. In the course of writing this post I’ve convinced myself that this is a recipe for misunderstanding: either that function should be functional-style (return-modified-copy and –yes Boaz– with the arguments reversed), or it should be a (destructive) method defined on a ChartDefinition class and returning no result at all.
Notes:
When I ought to have been doing various kinds of weekend work, instead I was figuring out a mandolin version of a disquieting little instrumental piece by Thanasis Papakonstantinou. It’s Οργανικό (Organiko: “Instrumental”) from the album Αγία Νοσταλγία.
Here’s my rendition (5M mp3); youtube has the original.
Some differences you will notice:
Winter is coming, and I have to admit I’ve been playing computer games. Specifically, I’ve got myself hooked on SpaceChem. It’s a somewhat odd addiction for a programmer, since playing this game is in many ways very like algorithm design, but it definitely tickles me.
Until recently you could decide your own price for SpaceChem and a bunch of other games, with the Humble Voxatron Debut (Humble Indie Bundle number umpteen), but now the sale is finished so you can’t any more. You can get it for $10 on their site (Mac/PC/Linux) or on Steam or Playism. Or if you have an iPad, it’s only $6.
I envy iPad-owners immensely on the gaming front. SpaceChem would be lovely with a drag-around interface.1 So would World of Goo (and yes you can).
Osmos is another gorgeous game that seems perfectly suited to the touchscreen. It’s available for iPad; it will be on Android… someday.2
And finally, there’s a new release coming “early 2012″, from the makers of Machinarium and the two Samarost games: Botanicula. It looks as quirky as their earlier games, and features some extremely beautiful design. I’m excited for it.
Notes:
Olga has pointed me at another interesting analysis of the situation in Greece: Seven Myths about the Greek Debt Crisis by Stergios Skaperdas. Like the last time I weighed in on the subject, I can’t properly evaluate the economic arguments and I catch a strong whiff of bias (the section arguing that the public sector is not especially corrupt is particularly weak). But as an unrepentant ex-game-theorist I found the comments on who is gaining and losing from the current situation extremely interesting (as well as the discussion of the bargaining power that Greece has, but has not been using).
Most fascinating of all, though, is the fact that (apparently) nobody in Greece is seriously investigating the option of leaving the euro. Surely this is something that has to be looked at carefully, even if only to establish for sure that it’s not the right option? And it only takes a moment’s thought to see that there’s no way the Greeks could trust the IMF or the various other external groups involved to make such an analysis: while I certainly can’t tell if Skaperdas is right in saying that defaulting and leaving the euro is the best option for Greece, it would clearly involve a huge amount of damage to her creditors.
One thing has me absolutely baffled about the Greek political situation. As I understand it there are two major parties, both of which have lost huge amounts of credibility because of their involvement in the crisis. Surely this would be the perfect moment to launch a new political movement, on a radical nationalist platform (“Greece for Greeks, not for Germans and the IMF”) promising to revoke the austerity measures and tell the rest of Europe to go stuff itself. I’m not saying this would be a good thing; in fact it seems a bit like the rise of National Socialism out of the depression and instability of the Weimar Republic. But it seems like a perfect move for short-term political gain (and my internal game-theorist whispers the reminder that short-term gain is what matters in electoral politics). So why isn’t anyone doing it?
Cycling to work one morning, a scrap of newspaper (of unknown provenance) blew against my face. In the moment before the wind took it again I read the following:
Exercise: How many errors, and of what kind, are contained in the following sentence? I did not interpolate at that moment, as she was interfacing telephonistically.
Solution: The sentence contains one error, an error of etiquette. It is never impolitic to extrapolate a telephonic conversatory. The rule of remembrance is this: If the telephone may interpolate you, then you may interpolate the telephone.
Attempts to discover the source, while initially showing encouraging signs of progress, have proved fruitless.
So it looks like we’re going to give a rembetiko workshop when we visit my folks (in Golden Bay, New Zealand) for Christmas. Here’s the plan:
Rembetiko is the “Greek blues”, a style of Greek music from the urban underclass of the early part of the 20th century (lots of songs of unrequited love, oppression by the police and the state, drug abuse and small-scale criminality, and similar cheerful subjects). The music has strong Turkish influences and is mainly modal and monophonic (rather than the harmonic melody-plus-chords structure of much of Western music).
We’ll look at three of the many modes (probably hitzaz, ousak, and something else yet to be decided), and learn one song in each (more if there is time and enthusiasm!). You don’t need to be able to read musical notation, but we’ll bring sheet music for those that do (and lyrics in Greek, for anyone who fancies a challenge).
We play: bouzouki, baglamas, guitar, accordion, mandolin (and we sing, or at least Olga does). You play: whatever you bring! Other traditional rembetiko instruments include violin, oud, kanoun, and ney for melody, and darbuka and tambourine for percussion (if you don’t know these wonderful instruments, search them out and get to know them!). If you play something else, don’t let tradition hold you back; the only constraint is that you’ll need a lot of chromatic notes (or a careful matching of instrument to song), since the modes don’t match the Western major or minor scales.
Since writing that outline we’ve made some progress in choosing modes and songs:
While it’s unlikely that anyone reading this (a) will be in Golden Bay over the summer and (b) hasn’t yet heard about this from me, if you are that person and you’re interested in joining, feel free! There will be no cost (except possibly a demand for baking). Not sure exactly when it will happen yet, probably around Christmas and definitely before New Year.
Notes: