Like many, this blog has been sadly neglected of late. Like many, I feel bad about it too. In my case the problem is simple: while I want to share my research notes and related material it takes a lot of time to format them so they makes sense (i.e. including the bare minimum introductory material to make it halfway self contained). And, generally speaking, I’ve lacked the discipline to do this rather than, say, trying to solve another research problem for an extra 20mins…
I’m not really sure how to solve this problem. But I’m going to try an experiment: I recently got an iPad and I’ve noticed that with it I’ve been able to make use of lots of little periods of “dead time” between meetings etc. because it is so easy to “just quickly” type an email etc.
With the wordpress app (which is sadly really buggy and keeps dumping…) I figure I can at least try and work on the blog with the iPad. Necessarily I’ll probably end up writing a lot of shorter soft posts (a format that is probably better suited to google Buzz, but no one will read that…) But at least something is better than nothing.
Anyways, to finish, I thought I’d share something I discovered today that I found really striking. A long time ago in another life I briefly worked as a research assistant in a CS dept. One of the things I was meant to do was to work with a program written in ML, a functional programming language, see e.g., this.
I was completely defeated by the task; I simply didn’t “get” functional programming, I mean, you don’t use “for” loops. Huh?!
Anyone who has used a spreadsheet has experience of functional programming. In a spreadsheet, one specifies the value of each cell in terms of the values of other cells. The focus is on what is to be computed, not how it should be computed. For example:
- we do not specify the order in which the cells should be calculated – instead we take it for granted that the spreadsheet will compute cells in an order which respects their dependencies.
- we do not tell the spreadsheet how to allocate its memory – rather, we expect it to present us with an apparently infinite plane of cells, and to allocate memory only to those cells which are actually in use.
- for the most part, we specify the value of a cell by an expression (whose parts can be evaluated in any order), rather than by a sequence of commands which computes its value.
An interesting consequence of the spreadsheet’s unspecified order of re-calculation is that the notion of assignment is not very useful. After all, if you don’t know exactly when an assignment will happen, you can’t make much use of it! This contrasts strongly with programs in conventional languages like C, which consist essentially of a carefully-specified sequence of assignments, or Java, in which the ordering of method calls is crucial to the meaning of a program.
Now there’s an explanation that speaks to me! This one paragraph has completely unlocked the functional language thing for me! It just goes to show that often all you need is the right person to say the right thing to you at the right time.
Note: I don’t really intend to write any functional programs.