Archive for the ‘lisp’ Category

ILC 2009 – I’m going?!

Friday, February 27th, 2009

Quite unexpectedly – to myself, at least – I’ve registered for ILC 2009. The title/theme/tagline is “The Next 50 Years”. Judging by the invited talks, the next 50 years seems to be reinventing CL in Scheme. (Although a 50 year estimate for R8RS doesn’t seem unreasonable.)

Not really sure what to do about the tutorials; I’ll probably end up listening to Pascal all day.

The Great Macro Debate “Are Macros a Menace?” seems a rather desperate attempt to gee up a controversy where there really oughtn’t to be one. On the other hand, if Guy Steele argues for the affirmative in terza rima it could be fun…

Predicted dark-horse highlight: Didier Verna’s CLOS efficiency paper. Predicted dead-horse lowlight: ALU Annual Meeting.

What else should I be doing in Cambridge/Boston while I’m there? 

Stackoverflow answer of the day

Monday, September 29th, 2008

A stackoverflow question entitled “Python Vs. Ruby for Metaprogramming” begins “I’m currently primarily a D programmer and am looking to add another language to my toolbox, preferably one that supports the metaprogramming hacks that just can’t be done in a statically compiled language like D. I’ve read up on Lisp a little and I would love to find a language that allows some of the cool stuff that Lisp does, but without the strange syntax, etc. of Lisp.” and goes on for another 20 lines listing various desiderata.

The currently top-ranked answer, in its entirety: “Grow some and learn Lisp.”


Tuesday, April 22nd, 2008

Amsterdam turned on its best summer weather for the European Common Lisp Meeting 2008. But enough scene setting. To give a quick rundown of the talks:

InspireData: How We Did It In Lisp Jeremy Jones

A very whizzy, very polished shrinkwrapped Windows and OSX application written in Common Lisp that actually sells well (> 80k seats sold). 12MB of lisp code in 284 source files. Key learnings: specification is hard so incremental refinement is necessary, and “Lisp supports this better than anything I know”. Key quote: “The world needs to use more lisp.”

FEMLISP Nicolas Neuss

A system for solving partial differential equations using finite element methods. 30K lines of lisp code. Key quality: the stability of the base language – “I learned Common Lisp and I’m still up-to-date!” FEMLISP currently has one user, and there seems to be some reluctance to increase that number…

Using Common Lisp For Large Internet Systems Stefan Richter is a 60 person company that builds large internet systems in 98% Java with the rest being C and C++. (See also  h.w.a.) While it is easy to make mistakes, it is well known how to build large internet systems (1 million users and above). The various bits and pieces are usually in Java, but almost everything could be done in CL today, and certainly tomorrow with a bit of effort. The talk seemed to diverge at this point. On the one hand we should be encouraging people to use lisp in web programming (use weblocks and blog about it; “write a book”). On the other hand we should be introducing call-cc into CL, because (despite seeming to contradict many of the best practices for building scalable internet systems) they are really cool for web apps…

PWGL Killian Sprotte

Killian had a great two-hour presentation on the impressive PWGL/Patchworks with OpenGL musical composition and analysis tool (or “Programming with Boxes”). Unfortunately he only had 45 minutes to present it. Certainly the talk with the highest “wow” factor, this is one to download and try out, not to read (or write) about.

ECL = (not only) Embeddable Comman Lisp Juan José Garcia Ripoll

A presentation of the past, present and future of ECL. A pretty convincing demonstration that ECL is not stripped down, but is a fully fledged Common Lisp (to mix my metaphors).

Selvaag House Designer Kristoffer Kvello

Using Knowledge Based Engineering and CL to automatically design buildings. Six full-time lisp programmers. Impressive application. I’ve always thought lisp uniquely suited to automated compliance applications – turns out I was right. Key observation: “Lisp: all good, no problems.”

HPC Platform Marc Battanyi

Subtitled “CL + FPGA = The Ultimate Processing Platform (or the Worst Case of NIH Syndrome)”, this presentation was another that suffered from being too long for its timeslot. All is forgiven, however, because Marc’s humour is bone dry.

? Ken Tilton

Ummm. This was Cells redux redux. I think. As a proponent (exponent?) of Screenshot Driven Development I can’t disagree with Kenny’s decision to concentrate on (as he put it) “stupid pet tricks”, but with no discernable structure, narrative or point, I really didn’t feel I learned anything…

All in all, the talks were great, the crowd interesting, the venue unique, and, while I won’t be at ELS in Bordeaux, I’m definitely intending to be at ILC ’09 at MIT (driven by Dan Weinreb – who was in Amsterdam – and Guy Steele – who wasn’t). I might even actually have done some lisping by then…

Arc, Brucio and The Register

Tuesday, February 26th, 2008

Christophe Rhodes had tipped me to this, which some have not seen. The interesting part is in the fifth paragraph: “Unsurprisingly, the reaction has been mixed with some applauding how Arc strips the Lisp language down to its bare essentials.” Note who the applause comes from.

Test trial ZSLUG meeting 0.1 alpha

Tuesday, February 26th, 2008

Last night was the first ZSLUG (Zürich Scheme/Lisp Users Group) meeting at the Lion Bar. This turned out to be both a fantastic success – in that about 15 people turned up – and something of a failure – in that there were so many people it became impractical for Juho to complete his presentation on SBCL code coverage. The search for an alternative venue/plex is on…

Down my end of the table(s) talk was about R6RS and the social psychology of standardisation; ARC and the rôle of Paul Graham in the (Common) Lisp community; theoretical physics and the bandwidth requirements of CERN; performance characteristics of Bigloo, SBCL and Chez Scheme; why developing in Schemes other than Scheme48 is painful and the wonders of Slime; and the mystery of where all the lispers maintaining the Swiss International Airlines Limited application have gone.

I made a particularly unconvincing argument for the wonders of CLIM and Climacs. Must do better!

I was the first to leave, so things might well have broken up acrimoniously by the end of the evening, but judging on what I saw and heard I would have to say that ZSLUG has a great future ahead of it.

Controlling Word the Lispy Way

Tuesday, January 29th, 2008

In my last post I asked whether anyone knew how to replace automatically numbered paragraphs in MS Word with their textual (non-auto) equivalents.

No one replied.

So I had to do it myself. Startlingly simple for my humble needs, the solution consists of a key-code invoking a macro which shells out to cscript running a Jscript program. The slightly interesting point is that this last is generated by Parenscript, and looks like so:

(defvar wd-app (*get-object "" "Word.Application"))
(defvar a-doc wd-app.*active-document)

(defun de-number ()
  (let ((cnt a-doc.*lists.*count))
    (dotimes (i cnt)
      (let ((lst (slot-value (a-doc.*lists 1)
        (lst.*convert-numbers-to-text 3)))))

This is obviously far from being great style, but it gets the job done and has me wondering about all the other things I could be doing with parentheses…

NREVERSE vs. pointer manipulation revisted

Wednesday, October 10th, 2007

In “To NReverse When Consing a List or By Pointer Manipulation, To Avoid It; That Is the Question” (in Some Useful Lisp Algorithms: Part 2, MERL TR93-17, August, 1993), Richard C. Waters discusses whether it’s better, when consing up “a list of elements where the order of the elements in the list is the same as the order that they are created in time”, to push and nreverse or “maintain a pointer to the end of the list and use rplacd to put each element directly into its proper place in the list.” Waters’ conclusion is that nreverse is (was) often faster, but that in any case the speed difference is not enough to avoid the simpler nreverse approach.

To examine the differences Waters used two simple functions, maplist-nreverse:

(defun maplist-nreverse (f list)
  (do ((sub list (cdr sub))
       (r nil (cons (funcall f sub) r)))
      ((null sub) (nreverse r))))

and maplist-rplacd:

(defun maplist-rplacd (f list)
  (let ((r (cons nil nil)))
    (do ((sub list (cdr sub))
	 (end r (let ((x (cons (funcall f sub) nil)))
		  (rplacd end x)
	((null sub) (cdr r)))))

Timing the functions using #'identity as the map function he got the following results (Lucid Common Lisp on an HP-730):

input list length
1 10 102 103 104 105
nreverse 8.3 3.1 2.6 2.6 2.9 6.2
rplacd 8.5 3.3 2.8 2.8 3.1 6.4

(where the numbers represent computation time in microseconds per cons created).

For no real reason I replicated this on an Intel Core2 T7200 2.0GHz running Win32 and sbcl 1.0.6:

input list length
1 10 102 103 104
nreverse 0.1562 0.0469 0.0297 0.0250 0.0252
rplacd 0.1563 0.0469 0.0234 0.0227 0.0228

(where the numbers represent computation time in microseconds per element of the input list).

Although the trend seems to be for the rplacd version to be slightly faster, the differences seem minor, and we might as well adopt Waters’ recommendations:

In closing I would like to note that the very best thing to do is to avoid writing code that conses lists altogether. Whenever possible, you should use standard parts of Common Lisp that do the consing for you. In particular, you should use functions like replace, map, reduce, remove, union, etc. whenever they are appropriate. Beyond this, you should take advantage of looping macro packages such as loop and Series.

#lisp FEP – I want to learn lisp but I don’t want to use emacs

Saturday, August 25th, 2007


Your favourite lisp(s) + emacs + Slime (+ paredit) constitute a fabulous development environment that is widely used, and therefore widely supported, on #lisp. Eschewing this environment for something else will make it far harder for people to understand your problems and (if you ask nicely, and intelligently) help you with them.

(I also find it telling that when the smart folks who started developing lisp had the time and energy to build editors they built emacsen.)

However, if you really can’t stand emacs (perhaps because of a childhood incident with Richard Stallman, a wasp’s nest and a jar of manuka honey), you could use plain Vi (and give up the wonders of Swank) or Cusp, if you’re an Eclipse fan.

But don’t come running to us when something goes wrong.


“I want to learn Russian but I can’t be bothered with all the funny characters.”

* “FEP” = Frequently Expressed Predjudice

#lisp FAQ – How can I generate a standalone executable?

Saturday, August 25th, 2007


By following the instructions for your lisp implementation:

  • sbcl(sb-ext:save-lisp-and-die filename :executable t)
  • clisp(ext:saveinitmem filename :save-executable t)
  • OpenMCL(require "COCOA-APPLICATION")
  • ECL(c:build-program ...)
  • Allegro(generate-executable ...)
  • LispWorks(deliver ...)

These last two have a whole host of bells and whistles (including, in the case of LispWorks, a tree-shaker), but require the paid-for versions. (You should also check their royalty requirements.)


Why would you want to? Really? What commonly distributed systems in this day and age come in a single executable file, except as a delivery mechanism that subsequently sprays various libraries, databases and settings mechanisms around your filesystem?

Emacs newbies – don’t swap Ctrl and Caps Lock

Monday, July 23rd, 2007

Newcomers to Common Lisp are encouraged to use Emacs (see also Finseth) so that they can use the fabulous Slime (and one should not forget paredit) as a development environment. Those that don’t insist they’ll stick with Vim (and then unaccountably fail to develop slim-vim), or try Cusp, will at some early point be advised to swap their Control and Caps Lock keys to save wear and tear on the pinkie. Even EmacsWiki points to typically forthright Steve Yegge piece which leads off with this advice.

I say – No. The proper place for the Control key is not “on the home row” but on each side of the Space Bar, where Tom
Knight and the mothership intended them to be. And outside the Control keys should be the Meta keys, and outside them should be the Super keys, and finally the Hyper keys. This allows for what I think is a very natural way of typing key-chords – the modifiers with one hand, and the letter/symbol with the other. These are, after all, the sorts of keyboards on which Emacs was first developed.

How you do this will depend on your OS and your keyboard. For Windows, you might like to start here or here.* In OSX you can look in System Preferences > Keyboard & Mouse > Modifier Keys. For Linux, there are a thousand xmodmap and xkb tutorials…

The other keyboard reconfiguration I recommend is, where possible, to put the parentheses on unshifted keys (swapping with the [square] brackets works on some keyboards). Of course, if, like me, you live/work in a locale with all manner of chicken scratchings on top of proper latin letters this may not be possible or convenient. (Eric Naggum’s more radical approach can be seen here.)

So, my advice for Emacs (Climacs, VBacs) newbies would be: don’t swap Caps-Lock and Control, swap Alt, Ctrl, Windows, Application, AltGr…

* For example, if my Windows XP notebook had the following key configuration to the left of the spacebar
(from right to left, inside to outside)
Alt Windows Ctrl and I wanted it to be Ctrl Alt Windows, I would do the following:

  1. Fire up regedt32.exe and navigate to HKEY_CURRENT_USER\Keyboard Layout.
  2. Create a new entry Scancode Map (using Edit > New > Binary Value).
  3. Edit the new entry (using Edit > Modify Binary Data) to contain the following:
        0000   00 00 00 00 00 00 00 00
        0008   04 00 00 00 1D 00 38 00
        0010   38 00 5B E0 5B E0 1D 00
        0018   00 00 00 00

    The table is in little-endian form. The first 8 bytes are header (all zeroes). The next four bytes contain the count of entries (4, including the sentinel). The three following four byte entries swap Left Alt (0x38) with Left Ctrl 0x1D), Left Win (0xE058) with Left Alt, and Left Ctrl with Left Win. The last 4 bytes are a null terminator/sentinel.

  4. Close up, log off, log on, and enjoy.

If you did this, of course, it would be entirely at your own risk.