A while ago I wrote a semi-port of Haskell’s QuickCheck. Easy enough – a property is like a test method but with arity 1, into which you inject data – potential counterexamples to your theory. In Haskell, the type system can, through unification, figure out the type of the generator required for that property. What to do in a dynamic language?
I really hate null!
Reflect on that statement. Apparently Tim has a strong dislike for a concept found in lots of programming
languages (even brainiac languages like Haskell) and successfully used in millions of programs. He must be
crazy I wouldn’t like to have a discussion with him about something contentious like tabs versus spaces.
One of the features I used to particularly like about Rhythmbox was it’s ability to minimise to tray. This meant with a simple click of an icon I could briefly bring it up on my current workspace to play/pause and then hide it again. However, in the new 2.90.x releases, the upstream has decided to remove this, which has been annoying me over the last few days.
Luckily, Rhythmbox has a nice plugin system, so I can fix that. Having done this sort of thing a little bit before, but not for a while, I started at the plugin writing guide. As it turns out, in the 2 weeks between starting writing this and doing this post, they’ve updated that guide a lot, but at the time it was very out of date. My major guide was in fact the ‘Remember the Rhythm’ plugin off of the 3rd party plugins list.
Those with even a passing familiarity with Prolog should recognise statements like
[H|T] = [1,2,3]. In particular,
= here is not “is equal to” but rather “unifies with”. So that statement causes the variable
H to unify with
T with the rest of the list,
Clojure’s abstract bindings provide much the same capability –
(let [[h & t] '(1 2 3)] <do stuff>) – modulo the difference between pattern matching and unification, of course.
There’s a subtlety in something like
[H|T] = [1,2,3], at least, if your lists aren’t built of nested cons cells. Consider Smalltalk arrays. Suppose we have some
ListUnifier that will rip a
SequenceableCollection‘s head off, like
#(1 2 3). We’d like the tail to unify with
#(2 3) in other words. But that’s not a node in the original structure – it’s an entirely artificial node we wish to construct from the original collection. Firstly, how can we unify with only part of a structure and, secondly, how can we determine a solution from that partition?
LShift will be attending (and sponsoring) the next London Hacker News Meetup at 6.30pm on 25th January 2012.
The venue will be the Central Foundation Boys School, Cowper Street, near our offices in Shoreditch.
This is one of the regular meetups for readers of Hacker News, and, according to the hosts, assorted tech and
startup junkies. The meetups are described as pretty informal and a great opportunity to chat about projects,
get feedback and eat pizza and drink beer.
LShift is also looking forward to meeting talented, experienced, technologists with a broad set of skills and
itchy feet. Projects at LShift are developer-led and managed. Our developers are responsible for all aspects of
their work including architecture, design, delivery, project and account management. This, along with a relaxed
working environment and flexible conditions, makes LShift an interesting prospect for anyone weary of doing too
much of the same thing.
You are currently browsing the LShift Ltd. blog archives for January, 2012.