Lisps

More irritating programming-language wankery, so I can get this out of my head.

I want to write games, mainly. So I am concerned with efficient data structures, library support (especially sdl and opengl), and portability to Windows. Things like networking, threads and so on are honestly more common and less necessary, at least for the scope I am imagining –not very LARGE games. This also means that Python-ish performances are also potentially acceptable. Pretty much all of these implementations have way to interface with C as well, with various levels of ease.

In terms of speed I approximate it by defining a function that calculates the fibonacci function the dumb way, then use it to calculate the 40’th fibonacci number. It’s dumb but simple. These times are as tested on my i7 laptop; for reference, the same program in C compiled with gcc runs in 0.32 seconds.

Common Lisp

Common Lisp advantages: More mature libraries and implementations, not going to become out of date (even if we wish otherwise), dead sexy object system, excellent okay error handling and debugging (SBCL’s error messages suck ass), excellent macros, generally good support for data types and common useful tasks.

Common Lisp disadvantages: Incredibly silly names for things, lots of features are implemented as options of functions instead of composable bits and combinators, can take some work to be portable among modern systems.

Common Lisp things that bother me but don’t really matter: Someone really should take a machete to the standard. Plists, really? Attached sneakily to symbols in the intern table? You have keywords AND optional arguments for functions?

ASDF is supported by all of these and provides a widely-used library facility; this is actually a pretty huge advantage. And it’s apparently obsolete and replaced by Quicklisp, now. Vaguely applicable SDL and OpenGL bindings exist for all these.

Implementation Windows support fib 40 time optimized fib 40 time (declare (fixnum x) (optimize (speed 3) (debug 0) (safety 0))) notes
SBCL Partial 3 seconds 1.2 seconds
CMUCL No ? ? Lack of windows support sorta discounts it
clisp Yes 162 seconds 161 seconds
clozure Yes 1.4 seconds 0.86 seconds Holy shit
ecl Yes 67 seconds 66 seconds
ecl -compile Yes 8.6 seconds 6 seconds Wow that’s better; basically compiles to a DLL

Scheme

Scheme advantages: Smaller and simpler, which makes it easier to understand by a pretty significant margin. Cleaner design means a lot less leafing through the spec looking for the difference between REMOVE and DELETE. SRFI’s are generally very good, when they are supported. Larger and more modern community.

Scheme disadvantages: More fragmented, you’re more tied to a specific implementation because the truly useful stuff isn’t very portable. Libraries and such aren’t as good most of the time; tied to specific implementations.

There are a couple Scheme packaging schemes: SLIB and Snow. Both broadly support chicken, scheme48 and gambit. Snow should be better but looks sorta like it hasn’t been touched in 5 years. Neither appear to have SDL or OpenGL libraries. The Chicken Scheme egg collection seems to be the only actually good package repo.

SRFI-9 defines record types. The language actually appears to get a lot better when you include a good pile of SRFI’s.

Implementation Windows support Good library support Structures fib 40 time sdl opengl notes
Racket native very yes srfi-9 2 sec native native Massively nonstandard; more a scheme-descended language of its own
chicken theoretical; no ready-made download but claims to compile under mingw very yes srfi-9 11 sec egg egg Compiles to C; could probably be faster if I ever figure out the type declaration syntax; no bignums
gauche native-ish pretty darn good srfi-9 15 sec broken native apparently not just for scripting
scheme48 mingw not so much srfi-9 62 sec no no Probably pretty easy FFI
gambit mingw soooooorta srfi-9 5 sec no no Easy FFI, at least… Compiles to C.

Other schemes exist… Iron Scheme, Bigloo, etc.

Conclusions

Use CL if you must. But really, for fuck’s sake, don’t use either of them. Gods dammit. There are better choices nowadays.

2016

This deserves revisitation in 2016, based on R7RS and general progress of technology. Schemes to try out may well include chibi, ironscheme, stalin, guile, forment, owl lisp (?), picrin, sagittarius. However, building games purely with SDL+OpenGL really does not appeal.