[ Content | Sidebar ]

Archives for December, 2010

Cold

December 31st, 2010

Here in Hastings it’s been cold just like the rest of the country. I walked right up to the highest point in the area a few days ago and it’s still covered in snow.

Here is some evidence of a cow caught on the fence:

This is probably the final post of the year which means I haven’t been nearly as productive as I was in 2009 with a measly 73 posts to last year’s 96. Must try harder in 2011.

Filed in photos - Comments closed

Borked Sheep

December 31st, 2010

This sheep, it not functioning anymore.

Filed in photos - Comments closed

Sparkle

December 30th, 2010

My dad has some magical glass that he can put in front of his camera to make things sparkle! Here I borrowed the camera and applied the sparklizer to the Christmas tree!

Filed in photos - Comments closed

Scheme on TV

December 24th, 2010

Here’s a collection of interesting Scheme videos you can watch instead of the usual Christmas TV:

http://programming-musings.org/2009/12/23/scheme-lectures-mostly

The Guy Steele Designing by Accident talk on the history of Scheme is really good (download the slides first). Watch the Gerald Sussman one too (it’s short!). Also, who doesn’t want to know the value of ((call/cc call/cc) (call/cc call/cc))?? Holiday fun for all the family.

This talk on a Scheme documentation language (and DSLs in general) is good also. From last year’s ICFP:

http://www.vimeo.com/6630691

Using SLIME with Chicken Scheme

December 12th, 2010

Common Lisp programmers are blessed with the awesome SLIME development environment for Emacs; but sadly Schemers have nothing comparable. There are a few SLIME backends for various Schemes around, in varying states of completeness, but as far as I can tell none for my Scheme implementation of choice: Chicken Scheme.

Therefore I present swank-chicken: a SWANK server written in Chicken Scheme. (SWANK is the protocol SLIME uses to talk to the inferior Lisp process.) I’ve been hacking it together over the past week or two and it’s now reached the point where it is more or less usable. Click on the screenshot below for an example:

Supported features so far:

  • REPL support with input/output (i.e. read and write work as expected)
  • Complile region and load file commands (e.g. C-c C-l, C-c C-c)
  • Basic SLDB support with back trace
  • Parameter argument hints in the minibuffer

Huge swathes of SLIME features are obviously missing at the moment, but the most useful ones are there. In particular, I think it’s at least as functional as the normal inferior-scheme mode. The most significant omission at the moment is support for interrupting Scheme evaluation from Emacs – C-c C-c at the REPL will currently kill the backend process completely. Naïvely this should be implemented in the same way as the debugger-abort command: by calling the top-level continuation. However, perhaps unsurprisingly, calling a continuation from a Scheme SIGINT handler turns out to be a bad idea. So if you have a runaway process you must kill and restart it with C-c C-c M-x slime-restart-inferior-lisp.

UPDATE: some of these issues have been fixed.

To get started clone the git repository using:

git clone git://github.com/nickg/swank-chicken.git

Alternatively just download swank-chicken.scm and chicken-slime.el.

First we need to install a few Chicken extensions:

chicken-install format symbol-utils

Obviously you also need to install SLIME: I’ve been using the latest code from CVS but older versions should work too.

Next, place chicken-slime.el somewhere in your Emacs load-path and add the following to your .emacs:

(autoload 'chicken-slime "chicken-slime" "SWANK backend for Chicken" t)
(setq swank-chicken-path "/path/to/swank-chicken.scm")
 
(add-hook 'scheme-mode-hook
          (lambda ()
            (slime-mode t)))

Now you should be able to use SLIME commands in a Scheme buffer. To start a Scheme REPL do M-x chicken-slime.

That’s it! Let me know if you have any problems/suggestions. I intend to do some more work on this and package it up as an Egg. The code is available under the MIT license.