SBCL, lispbuilder-sdl and cocoahelper

Download it, change into the cocoabuilder folder and hit make.

All being well it should build, and then, for the simplest possible life and the ability to load it via ASDF, copy the following files into your quicklisp installation folder as shown:

  • cocoahelper.dylib
  • cocoahelper.framework
  • cocoahelper.lisp

From there, run up SBCL from anywhere…

* (asdf:operate ‘asdf:load-op :cocoahelper)

Wait a tiny amount of time and then you should see something like this:


If you look in the dock you should see something like this.. I am not sure what it is for or does yet but I aim to find out… I guess on OSX SDL is going to try to use Cocoa as the rendering engine and this is some sort of bridge between the two world! Screen Shot 2016-03-10 at 18.21.04

After many years of thought and many years of using many languages, I am now more and more convinced that the “perfect” combination, if such a thing exists, is going to be a mix of Haskell, LISP and Prolog.

Exactly what “combination” means in terms of the different programming paradigms each presents is completely unknown to me at this point! Haskell is functional, Prolog is logical and LISP is everything.


First of all, the uniform s-expression shape of LISP is so absolutely pure, clean and simple that I feel it’s the true shape of expressing thoughts as code. If you work in LISP long enough you don’t even see the parens any more. Really. And the implied return value being the last thing you did is also useful.


Haskell is incredibly clean in its form. The use of a space character as the argument separator is cool. The functional aspect is also very very nice. What I don’t like about Haskell is the IO / monad thing, Sometimes it feels incredibly hard work to do things within the context of other things, pardon the pun but sometimes there’s just too much heavy lifting!


Finally, Prolog. We all know about predicate logic, true or false. There is something so clear and obvious about Prolog rules… that the rule is true if and only if every single sub-rule is true. The first version of Erlang was written in Prolog, and when I learned that I suddenly realised why the syntax of Erlang is like it is, it made Erlang much more readable for me.


Haskell and Prolog both offer pattern matching; once you understand and get used to the idea of extracting “if” tests out of the code and making them separate clauses, your code becomes much clearer and easier to read and reason about. LISP doesn’t have pattern matching per se but it does have multi-methods, something I am sure no other language yet offers at all (I could be wrong) and this from a language created back in the 1950-s! John McCarthy and his students did something truly amazing indeed.


So, what’s the ideal? The future is on highly concurrent and scalable systems. So functional programming is more than likely the way forward for lots of reasons to do with not passing around state and the ability to perform map-reduce optimisations on functions just by deductive reasoning on what it does, or more importantly, doesn’t do; rely on external state.

Compilers are getting smarter, we need to keep up!

I am going to think about this more actually, and maybe design an “ivory tower” conceptual language and throw it out there…

Command line atmospherics with mpg123

I have loved listening to SOMA.FM for years, especially Groove Salad.

I also recently found a brilliant little site called, which plays various background noises in response it seems to recent scientific study that shows a certain level of background noise helps you get in the zone, stay there and be more productive.

Being a command line person, I looked around to see if I could mix the two and not have to use a browser, and here is my solution, using mpg123:

You can put it into a script I guess like I did. The “-q” stops any output and the trailing ampersand backgrounds the processes; this stops junk appearing in your terminal window from time to time.

I can’t work without it much these days, it helps to drown out the office noise around me.

Why is software development still so hard?

Total experience to date: thirty-nine years.

Started with UCSD Pascal and Z80 assembler. Currently into Haskell and Prolog and anything functional. Putting all that to one side, as we all know that the language you use to implement a solution is by and large irrelevant, no really, you know it is… I find myself lately finding it harder and harder to want to embark on any sort of personal project.

A mere twenty years ago I was brimming with enthusiasm for it but these days I just find myself wanting to watch cat videos on YouTube.


I was spell-bound (and to some extent still am) at the age of eleven that you could “express an idea” in the language that the computer could understand, be it BASIC or whatever was available and then sometime later have that idea executing. Of course, the idea has to be information processing centric; that’s what the infernal machines do so well.


I realised that you could express solutions using any number of techniques ranging from things like Forth, OO with C++ or functional like Haskell or OCaml. And of course there is LISP, which basically does all of the above and from which languages continue to steal their latest batch of “new” features.


One realises that none of it matters. What matters is the logical process of teasing out “the solution” from “the requirements”. So why oh why are there new languages appearing more and more?

Yes, we are headed into the future heavily into parallelism, concurrency and fault tolerance and new languages promise to deliver those things. But until that happens, what about the poor clients who just want working solutions?




OSX GNU Guile — beating libltdl into submission

After encountering an issue with socket handling in the remote REPL server code I needed to build guile from source but it just wouldn’t.

I downloaded a mint latest source from and gave it this spell:

to make it overwwrite the Mac Porst version to see if that would fix it. It didn’t.

After further close reading of the configure help text for guile the answer was there as usual, resulting in this incantation:

Result… clean run of the configure script!

Now all I have to do is build it and get to the bottom of the problem. Apparently it only happens on OSX, Ubuntu is not affected, nor presumably is any other *nix.

Oddly, geiser mode works, if that is using com-int buffers then I don’t see why I cannot then use telnet or netcat to connect to the REPL server. We’ll see!

It’s got something to do with opening a socket in non-blocking mode then send() thinks the output buffer is full. I’ll spare you the details but just in case you are interested the bug report is here (original), I submitted a new one with lots more information but it’s not on the list yet.

Emacs fat fringes and colours

Having gotten used to various editors implementations of distraction free or presentation mode views, I figured that emacs could probably do something similar with little effort.

As usual, it could.

For me, distraction free means no clutter, no menu bars, tool bars, gutters, line numbers, just the code. The first step is to be able to set the size of the left and right margins to something large, 100px works quite well. I use Aquamacs a lot. This does not work in the terminal! So, here is the little bit of code you need to place into your beloved ~/.emacs file:

Then, using the Ctrl-U prefix, you would set the left and right margins to be whatever you want, let’s say we wanted to have 500px left and right, which works well for meo n my 1920×1080 display, the keystrokes:

will make the fringes become very wide and take on the current theme background colour. If you change themes a lot like I do, then just re-issue the sequence if the fringes end up a different colour. Sometimes it actually looks nicer!

Some other command that are useful in cutting down the visual clutter:

You could of course combine all of the above into a single killer command, make it interactive and also use the Ctrl-U prefix to turn it on or off. For example, if the prefix was set to a non-negative integer for example that could mean to enable the mode and any other value would disable it.

If I get some time I’ll write that command and stick it here.

OSX rsync and Google Drive

After a recent horrifying experience upgrading to El Capitan which resulted in basically losing my internal hard-drive for a week before I got it back (a whole other story) I have managed to wipe it, reinstall El Capitan and start getting my digital life back together.

I had most of my stuff backed up out there in the cloud but it was just the sheer inconvenience of it!

Anyway, I am now back in the game and and having learned the value of backups, I am toying with using “rsync” and the Google Drive application on my mac as it seems to be the easiest way to go, at least for me.

Sure, Time Machine, CrashPlan, Carbon Copy Cloner are all out there and serve a purpose but none feel right. Time Machine uses a black list, CrashPlan uses a whitelist approach. CCC…. TL;DR !

I’ve been using this for a while to great effect:

At the end of the day I just run it and go make a coffee… the only danger is knowing when it has finished but the flashing GDrive icon is a good indicator.

Hope that helps somebody find a real simple developer style backup option.

Control OSX Screen Brightness from Ubuntu 14.04 (on a USB stick!)

After trawling here and there and trying lots of different things, for me this works on my late 2012 21″ iMac with an ACPI card.

It’s best to put the script into a file, make sure the file is discoverable on PATH.

All details are in the folder:


which on my machine looks like this:

ubuntu@ubuntu:~/mc2$ cd /sys/class/backlight/acpi_video0
ubuntu@ubuntu:/sys/class/backlight/acpi_video0$ ls -l
total 0
-r--r--r-- 1 root root 4096 Oct 7 08:29 actual_brightness
-rw-r--r-- 1 root root 4096 Oct 7 08:29 bl_power
-rw-r--r-- 1 root root 4096 Oct 7 08:28 brightness
lrwxrwxrwx 1 root root 0 Oct 7 08:29 device -> ../../../0000:01:00.0
-r--r--r-- 1 root root 4096 Oct 7 08:03 max_brightness
drwxr-xr-x 2 root root 0 Oct 7 08:29 power
lrwxrwxrwx 1 root root 0 Oct 7 08:29 subsystem -> ../../../../../../class/backlight
-r--r--r-- 1 root root 4096 Oct 7 08:03 type
-rw-r--r-- 1 root root 4096 Oct 7 08:03 uevent

WARNING: If you use values higher than the maximum allowed for your card you *MAY* cause damage. The limit on my machine is 15 as indicated in the file

echo $1 | sudo tee /sys/class/backlight/acpi_video0/max_brightness

There are more exhaustive solutions out there including one I saw that didn’t work first time for me that limits the value but for me, being a hacker, I only needed a one liner. YMMV.

DISCLAIMER: If you damage your machine, that’s your fault not mine!!!

Cross platform development with Scheme

Just a quick note about something I recently found whilst trying not to buy MOCL…

LambdaNative is developed and maintained by the Pediatric Anethesia Research Team (PART) and the Electical and Computer Engineering in Medicine (ECEM) group at the University of British Columbia (UBC).

I have spent a week or two evaluating it and accidentally contributed a pull request that got merged and one that didn’t and I have to say that, for what it offers, it is awesomely good.

Having personally spent many hours with it now, I do not yet think it is ready for mainstream development for a few reasons. I don’t mean that it a bad way either. What I mean is that the language, Scheme, is not really that widely known and as such it probably won’t break out into the public arena any time yet.

That’s a real shame.

Because I think that they have achieved an amazing thing; total abstraction of the underlying platform with a really powerful, underestimated language.

Go visit the site, give it a try. You will learn something.

Prime Peace

I think prime numbers are the numerical expression of peace. Restful nodes in the vibration of everything.

Prime factorisation has always struck me as something truly astounding and it is reassuring to know that awsesome minds are hard at work trying to solve the Riemann hypothesis right now.

There are some truly wonderful professional and amateur (in the nicest sense of the word) explorations I have watched recently and the ones that moved me the most, in order of cool factor were:

This guy,Carlos Paris, has put in some serious work with AutoCAD and made some interesting observations. I truly enjoyed watching all of his four videos. Awesome work Carlos. As an interested amateur I found his work and thoughts to be very compelling. I am sure the professionals would groan or moan but to me this video is most excellent and informative.

Speaking of the professionals, this video is also very interesting to watch as it goes some way to visually explaining the Riemann hypothesis in a way that a layman can understand (that’s me), in fact I believe his audience to have mostly consisted of young kids and their parents!

So… as I continue my studies and dreaming of a million dollars, I truly hope that there is another (Sir) Andrew John Wiles out there close to a proof of RH.