5 ms·
The Art of Lisp and Writing (2003)
- enduser 13y agoChoice quotes: "Lisp is a medium for working with a computation until it is in balance with its external and internal requirements. At that point it can be decorated with performance-enhancing declarations and perhaps additionally modularized. In this it is more like an artist's medium than what many think of as a programming language." "Writing a beautiful text takes sitting before a medium that one can revise easily, and allowing a combination of flow and revision to take place as the outlines and then the details of the piece come into view. Changes are made as features of the writing emerge—first the noise, then the sense, the force, and then the meaning—and the work of the writer is to continually improve the work until it represents the best words in the best order. Great writing is never accomplished through planning followed by implementation in words, because the nature of the word choices, phrasings, sentence structures, paragraph structures, and narrative structures interact in ways that depend of each other, and the only possible plan that can be made with which a writer can "reason" about the piece is the piece itself." "The difference between Lisp and Java, as Paul Graham has pointed out, is that Lisp is for working with computational ideas and expression, whereas Java is for expressing completed programs. As James [Gosling] says, Java requires you to pin down decisions early on. And once pinned down, the system which is the set of type declarations, the compiler, and the runtime system make it as hard as it can for you to change those assumptions, on the assumption that all such changes are mistakes you're inadvertently making. There are, of course, many situations when making change more difficult is the best thing to do: Once a program is perfected, for example, or when it is put into light-maintenance mode. But when we are exploring what to create given a trigger or other impetus—when we are in flow—we need to change things frequently, even while we want the system to be robust in the face of such changes."
- Jimmy 13y ago>"The difference between Lisp and Java, as Paul Graham has pointed out, is that Lisp is for working with computational ideas and expression, whereas Java is for expressing completed programs. As James [Gosling] says, Java requires you to pin down decisions early on..." My experience with modifying Lisp and Java programs has largely been the opposite. I've been working on a Java application for the past few weeks, and the design of the program has changed several times as I've thought of new features to add and cleaner ways to organize my code. Today, I had a class X that was responsible for keeping track of a certain variable, and I wanted to move that responsibility to class Y. I deleted the relevant field and all references to it in class X, and Eclipse highlighted all of the errors that change introduced. I fixed the highlighted errors and added the new methods I needed to class Y, and when I tested the relevant functionality, I saw that I had introduced only one minor bug, which I fixed with a single line of code. There was nothing difficult about the process. I've found refactoring Lisp programs to be more difficult. When I was writing a prototype of this same application in Lisp (Clojure more specifically), I had a macro to implement a small DSL. The macro was not particularly complex, although it was non-trivial: it did some code walking and called some helper functions. When my DSL grew past a certain size, making changes to its implementation became rather difficult. Sometimes the compiler would report errors at runtime, but more often than not, things would just stop working in mysterious ways whenever I made a change. The macro's output was also quite different than the kind of code I would write by hand, so debugging was difficult. I'm not the best Lisp programmer, so I'm not trying to say that Lisp always makes it hard to change your programs. But there are cases where Java makes it very easy to change your programs.
- enduser 13y agoTooling around Java (e.g. Eclipse) has developed significantly since the time this article was written. If you're working in programs where the system is too big to fit in your mind, good tooling certainly helps. Lisp is especially powerful for programmers who are able to work with large and complex mental models of systems. and Debugging Lisp in Lisp is far superior (easier) compared to debugging Lisp in Java (which is what you get when you use Clojure). Clojure has been getting a lot of press as being the rebirth of Lisp, and it includes some useful paradigms in the core language, but it is woefully incomplete as a full Lisp development system when compared to mature Common Lisp implementations.
- peter-fogg 13y agoOut of curiosity, what do you see as the difference between Common Lisp debugging and Clojure debugging? I'm mostly experienced with Clojure (my CL code consists of a few trivial programs), but it seems like Lisp in the right environment (Emacs, paredit, SLIME/nrepl) is a joy regardless of which Lisp.
- seanmcdirmid 13y agoAs someone who writes academically and writes code in the form of research prototypes, I really have to disagree to some extent with RPG and PG. Code is code, it doesn't have to be elegant, it doesn't have to be read, and using a less elegant language (like say C#) can be liberating compared to one where more elegance is possible (say Scala). The architecture you are working on floats around in your head regardless, becoming more beautiful, and the language that it is expressed in is just a detail...it is easy enough to throw the code away and start again once it becomes too unwieldy and you need to take your design to the next level. But then RPG also wrote "worse is better."
- enduser 13y agoCommon Lisp was designed for large, complex applications where it is not "easy enough" to throw code away but existing codebases must be evolved in-place. It is a practical language, not an academic language. In academia, your code is a reflection of your conception and can be changed when the conception changes. In the "real world" the satellite you already launched into orbit needs a new feature.
- seanmcdirmid 13y agoNobody is writing satellite code in CLOS, though. I like CLOS, I still get many new ideas from that language (I'm in PL), but claiming it is a language designed for scalability is a bit weird. Even C++ would be a bit more safer depending on what flavor of CLOS you are using. My point is that C# is a good enough language for rapid prototyping; that the premature commitment problem is not a big deal in practice. I couldn't really imagine the argument evolving into "premature commitment AND rewriting code is bad" in any coherent manner.
- enduser 13y agoI'll just leave this* here: http://www.stsci.edu/institute/software_hardware/spike/ http://www.stsci.edu/institute/software_hardware/spike/ * satellite code written in Lisp
- cowcatcher 13y agoThis person isn't a very good writer. I've read through it once and I'm not sure what the point is supposed to be. LISP and Java are different -- ok, that's pretty obvious. Some fuzzy stuff about embracing creativity, ok, fair enough but also fairly trite and more suited to an Apple TV commercial. Programming is an art as well as a science, yes, that's nice. Some things are plainly false, for example, "the theory of quantum mechanics and the expanding plausibility of complexity science threw everything we knew about the world into doubt." Did it really? So before we knew that London was the capital of the UK and that 2+2=4 but the "expanding plausibility of complexity science" caused people to doubt that? In sum, a tedious and pretentious article.
- michaelwww 13y ago"Lisp is the language of loveliness. With it a great programmer can make a beautiful, operating thing, a thing organically created and formed through the interaction of a programmer/artist and a medium of expression that happens to execute on a computer." It's this kind of statement that makes me suspect Lisp is not very practical. I'm not programming for the sake of programming to create something that "happens to execute on a computer." There are other artistic endeavors for my free time that are more interesting than a lovely computer language.
- enduser 13y agoThat's like saying that a walker allows you to traverse a floor more "practically" than dancing.
- michaelwww 13y agoSo in your estimation all other computer languages are walkers compared to the beautiful dance of Lisp? I'm curious, maybe I really do need to learn Lisp.
- enduser 13y agoThat is my estimation. If you don't need performance or macros, Python and Ruby may give you a similar development experience. However, neither of those languages AFAIK allows you to redefine (let alone recompile to native code) functions at runtime.
- Jimmy 13y agoRuby is an extremely dynamic language, where you can redefine almost anything at runtime: def f() puts "f1" end f() if true def f() puts "true" end else def f() puts "false" end end f() This outputs: f1 true As for native code, apparently MacRuby [1] compiles to native code, although I've never used it, so I don't know the details of that claim. Can you give an example where redefining a function at runtime is a useful feature to have? I don't mean this as a challenge, I'm just curious. I like the extreme flexibility that dynamic languages provide, but it seems like the most dynamic features are mainly useful for library writers. [1] http://stackoverflow.com/questions/1972388/is-it-possible-to-compile-ruby-to-byte-code-as-with-python http://stackoverflow.com/questions/1972388/is-it-possible-to...
- dschiptsov 13y agoIgnorance more frequently begets confidence than does knowledge. such a good summary of Java (and now Javascript) madness.)