Faster and smaller Haskell, with a pointer to Qi

Haskell is one of those languanges i keep an eye on, accumulating links and books in my maybe/someday task list (the other forerunner in there being Smalltak). To be fair, i’ve actually read a couple of tutorials and books, but, for some reason or the other, it never sticks in (a minor nit that, in the long run, ends up being a hurdle is that, unlike Smalltalk’s, i find Haskell’s syntax ugly).

Haskell has a long list of features that make it an excellent, and sometimes unique, language. Some of them i miss in Lisp, like (built-in) pattern matching a la ML or currying, which fits like a glove in a functional programming style (if you’re in maths or physics or for some other reason play a lot with tensors, you’ll be currying all the time). As an aside, some months ago i noticed that i am not the only one to miss these features in Lisp: Lambda Associates‘s Qi extends Lisp precisely in those directions (and then more).

Another fun feature of Haskell is laziness (but we have that in Scheme too). On the one hand, it provides the means for extremely elegant constructions, like e.g. circular, infinite data structures. On the other hand, it poses lots of challenges when it comes to evaluate and/or guarantee time and space requirements for your programs. I just found and article entitled Making Haskell programs faster and smaller which makes an in-depth analysis of these (potential) problems, with solutions, that may help you in your Haskell adventures. My unqualified opinion is that i prefer the Scheme way: call by value by default, with call by need, well, when needed.

Tags: ,

Ancient HisTory

I love reading about the history of computers and computer programming. There’s an amazing collection of tales on discovery, on people breaking new grounds. And the best part of it is that those people are still here to tell their story… i sometimes even regret not having been born 20 years before.

Of course, there’s a lot of Lisp lore waiting to anyone interested. My last readings on Lisp history include History of T, by Olin Shivers. T, one of the first Schemes, was one of the best Lisp implementations, and, according to Paul Graham, set a standard for clean design that few newer dialects have been able to meet. Olin gives a detailed survey of its history, which took place mainly at Yale, MIT and CMU, and features Richard Kelsey, Ken Pitman, Jonathan Rees and RMS among many others (have you ever wondered how those guys look like?). Rees has also put online a web page dedicated to T.

Recently, there has even been some talk (and code) about a T revival, although, by now, you will need a Solaris SPARC to run the system. While you wait for a port to your favourite architecture, you can still learn and enjoy from the T manual in PDF: it goes full of neat ideas for that new language of yours.

Update: I just found an implementation of T’s object system in 20 (!) lines of Ruby. See it by yourself in this post by Christian Neukirchen.

Tags: ,

I want one of those!

Nowadays, Lisp Machines are legendary stuff. People drool over LM porn, and for a good reason. Unfortunately, Lisp Machines are also something of the past, and those of us who weren’t in the right place some 30 years ago (or that weren’t at all) must content ourselves with photos and videos… mustn’t we? Well, as it turns out, there’s a gift waiting for you if you’re quick enough: Jainer Joswig is mentioning that 24 TI Explorer Lisp Machines are looking for good homes. You pay the transport, but the computers are free.

This is how they look like. I already wrote my email to Father Christmas!

Tags: ,

Posted in Lisp. 1 Comment »

Installing (i)Maxima on OS X

I got interested again in Common Lisp a few months ago via the Maxima Computer Algebra System, an evolution of the DOE Macsyma project. Maxima is simply awesome, and a homage to the power of Lisp. Actually, i was looking for tensor algebra packages. Maxima does that and a lot more via its many interfaces.

Of course, there are several interaction modes to embed Maxima sessions into Emacs. The nicest one is, in my opinion, imaxima, which typesets Maxima’s output using LaTeX. Bill Clementson has published a tutorial on how to get Maxima running on OS X, using SBCL with imaxima and gnuplot. I followed the instructions and finally installed the whole pack, but only after a few tweaks that i’m posting below to save you the time of rediscovering them:

  • I’ve got SBCL 0.9.8 installed via Darwin Ports, and download the latest Maxima source tarball (5.9.2). There is a Maxima Darwin Port, but it uses CLISP.
  • The familiar configure/make/make install chore works without problems. But if then you try to run maxima, you’ll get an error from SBCL:
    fatal error encountered in SBCL pid 7275:
    more than one core file specified
    

    This is because /opt/local/bin/sbcl is actually a shell script which runs sbcl.bin with a predefined core. In turn, maxima is a shell script which invokes sbcl. So the fix is easy: create a sbcl.max containing something like

    #!/bin/sh
    /opt/local/bin/sbcl.bin "$@"
    

    and modify /usr/local/bin/maxima to invoke sbcl.max (search for exec “sbcl”). After that, invoking maxima from the command line should work just fine.

  • Now for the Emacs interface. I use Carbon Emacs, which comes with imaxima installed. So i just needed to load it. There’s an info page that tells you how to do that. Follow the instructions… and you get an error: latex complains it doesn’t know anything about ‘pagecolor’. After a bit of fiddling, i fixed that by setting the appropriate custom variables. Here is my (i)maxima emacs configuration file
  • Optionally, install the breqn LaTeX package to get multiline equation display in imaxima. I just downloaded the package and put its contents into /opt/local/texmf-local/tex/latex/breqn. Afterwards, running ‘sudo texhash’ completes the installation (you will know it worked if ‘kpsewhich breqn.sty’ locates the package).
  • Maxima uses Gnuplot to render 2D and 3D graphs. No problem: Gnuplot is included in Darwin Ports, but make sure to use the x11 variant (i had it compiled with +no_x11 and used AquaTerm).

That’s it. Surely, the above are trivial details, but still may save you a handful of minutes that you can spend far better. For instance, playing with your fresh Maxima installation. Enjoy.

Tags: , , , ,

Scheme as a religion

I’ve spent a couple of hours reading a currently running thread in comp.lang.scheme entitled Scheme as a religion, started with a delicious typo:

As an avoid [sic] computer science student who hopes to attend to UC Berkeley…

The post goes on in an uninformed and superficial critique of Scheme, which is more or less dismissed as something whose time is over. In other newsgroups, such a beginning would have quickly degenerated into a don’t-feed-the-troll flamefest, but not in c.l.s. Instead, lots of insightful posts have followed. One of them has pointed me to two jewels (co)authored by Guy Steel: his Ph.D. thesis (i didn’t know that it is available online) and The Evolution of Lisp (with Richard P. Gabriel). Wonderful stuff. And a great community.

Tags: ,

The Lord of The Lambdas

Data and procedures and the values they amass,
Higher-order functions to combine and mix and match,
Objects with their local state, the messages they pass,
A property, a package, the control point for a catch-
In the Lambda Order they are all first-class.
One Thing to name them all, One Thing to define them,
One Thing to place them in environments and bind them,
In the Lambda Order they are all first-class.
                -- The TI PC Scheme Manual

(From a recent post on c.l.l. by Rainer Joswig)

Tags:

The Lisp Machine Wars

This is an essay written a while ago (1986 or so) by Richard M Stallman (RMS), about his experiences at the MIT AI Lab, and the story of the Lisp Machine Wars.

Tags: ,

Olin Shivers papers

Olin Shivers, the mind behind the excellent scsh, hardly needs a presentation. I’ve learnt today, in #scheme, about this listing of his papers. Well, the first day of the new year is not yet over, and i have already collected readings for the rest of 2006.

Tags:

Infornography

Gene Michael Stover has collected a lot of useful resources for programmers, with a strong Lisp bias. More and more readings for this new year!

Tags:

Best of Bill

Bill Clementson’s is probably my favourite programming blog. To say goodbye to the past year, he has published a summary of his most popular posts during the last three years: highly recommended readings for the new year, if you missed any of them.

Tags:

Follow

Get every new post delivered to your Inbox.

Join 31 other followers