Archive for January, 2013

Android and Kawa

Thursday, January 17th, 2013

Anyone who enjoys functional programming is going to have a rough time on Android. You’re basically locked into Java because most of the functionality of the OS, the UI for example, isn’t exposed to C code. So it’s time to find a Scheme implementation that works on top of davlik. Turns out Kawa works pretty well and it’s blazing fast. Unfortunately there really isn’t enough information out there about how to use it, Kawa’s documentation leaves much to be desired and its error messages can be beyond cryptic.

I translated some examples from Java into Scheme and set up some scripts to help with setting up new projects, you can everything on github. At the bottom of the readme file I documented some of the more exciting error messages. Even though I tried to stay at close to the original Java as possible, even when it felt pretty disgusting, I couldn’t help myself in some cases. Take starting a new thread. In Java that takes several lines and a new class, and due to the lack of macros can’t really be shortened much. In scheme with a trivial macro this becomes simply (thread code ...). It doesn’t get more beautiful than that. I’ll be putting up a full Android application sometime in the near future.