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. (more…)
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
to unify with
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
that will rip a
’s head off, like
#(1 2 3)
. We’d like the tail to unify with
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?
You are currently browsing the LShift Ltd. blog archives for January, 2012.