Lisp as a crucible

Scheme and Lisp force you *think* from the get-go. Most engineers and programmers hate to do that and it makes them uncomfortable. Starting a program in Java or C is easy. There’s a pile of boilerplate you can type without thinking about it, and it `feels’ like you’re programming. Then you have to haul out the bag of tools like the compiler and the linker and makefiles or ant. There’s a lot of busy work needed just to get going, and you feel like you’ve accomplished something.

In Scheme or Lisp, you start it up and there you are at the REPL. You have to decide what your program is going to do. You can’t waste time writing boilerplate (it’s unnecessary), designing data structures (just cons one and specialize it later), figuring out how to build complex inheritance hierarchies (do that once you know what you are doing), you have to dive into the problem right away. If you are willing to make mistakes and learn from them, then the REPL is a great place to play. If you prefer to plan ahead so you don’t make mistakes, a REPL is a very uncomfortable place to be.

— jrm

Having experienced the “discomfort” myself, I recognize now that this development approach acts as a mirror to your strengths and weaknesses. It reveals, very very quickly, whether or not you really have got a grasp both on the problem and how you plan to solve it. There is no where to hide! It is great.

(via R6RS)

13 thoughts on “Lisp as a crucible”

  1. The REPL is for informal testing. Formal unit tests are all the rage these days, but if you haven’t quite planned out what you’re making, it’s hard to come up with proper tests. The REPL makes it very easy to see what’s going on.

    It’s only for throwaway code – anything you’re planning to keep should go in a file buffer and be incrementally evaluated.

  2. Bob: The image is the state, not the code. I can read and edit code I find on the web without any comments. I’m definitely not sure that I can get back the source or fix a function that calls function “distplay” instead of “display”.
    Also, the image does not contain everything: it dumped all that has been done. If the first thing I wrote was “(display 42)” then it’s not in the image you build after that. OTOH, it’s still in my source code. You can’t either rename FOOs in BARs with an image.
    blah blah, you get the idea.

    To *write* modifiable code, it takes an editor. To run code, it takes an REPL.
    The fact is Lispers often mix the two.
    But to me, writing a Lisp program with just the REPL is like writing assembly with cat. Stupid. (though ASM&cat earns extra 2^8 Guru points if the program is correct)

Leave a Reply

Your email address will not be published. Required fields are marked *