Levi's Lisp Log http://lifeoflevi.com/blog/ Recent entries for Levi's Lisp Log en Guy Steele http://lifeoflevi.com/blog/archive/2006/07/guy_steele Wed, 26 Jul 2006 22:16:55 GMT People Programming <p><a href="http://bookpool.com">Bookpool.com</a>, an online computer bookseller, has put together a section where computer book authors list their favorite computer books from the last ten years. I wasn't familiar with many of the participating authors, but I was pleased to find <a href="http://en.wikipedia.org/wiki/Guy_Steele">Guy Steele</a> among them. <p>His <a href="http://www.bookpool.com/ct/184">list of favorite books</a> reveals a lot about him, and I hope to pick up some of them. The list is pretty well-rounded, from Knuth's <em>Computers & Typesetting</em> collection to <em>The Annotated Alice</em> and The <em>Art of the Incredibles</em>. Interesting stuff! WireWorld Computer http://lifeoflevi.com/blog/archive/2006/05/wireworld_computer Tue, 23 May 2006 22:15:03 GMT Theory Programming <p>You've probably heard of <a href="http://mathworld.wolfram.com/CellularAutomaton.html">cellular automata</a> before, at least in the form of Conway's Game of <a href="http://mathworld.wolfram.com/Life.html">Life</a>. There's another intereating cellular automaton called <a href="http://mathworld.wolfram.com/WireWorld.html">WireWorld</a>, which performs a model of electrical signal propagation across a grid. <p>A couple of dedicated souls decided to create a fully-functioning simulated <a href="http://www.quinapalus.com/wi-index.html">computer in Wireworld</a>. This is a wholly remarkable feat, considering the simplistic nature of Wireworld itself. The computer has another interesting property in that it only has a single instruction, yet is fully Turing-complete thanks to special-purpose registers. Bugfixes http://lifeoflevi.com/blog/archive/2006/05/bugfixes Tue, 23 May 2006 07:06:47 GMT Blog <p>I fixed a couple of bugs in the comment system tonight. First, there was a problem where an incorrect answer to the spam question would erase the fields entered into the comment form, which was inconvenient to a would-be commenter who I am sure accidentally typed the wrong answer. <p>The cookie that keeps track of the fact that you answered the question was set to only be valid for the current archive directory, so it only worked for posts made in the current month. It is now valid for the entire blog. <p>I also fixed an issue with the display of commenters' names who decline to leave a URL. The names now display in plain text instead of as a link to the current page. Denotational Semantics http://lifeoflevi.com/blog/archive/2006/05/denotational_semantics Tue, 23 May 2006 04:05:54 GMT Theory Programming Language-design <p>A <a href="http://hans.fugal.net/blog/">friend of mine</a> showed me some examples of the qualifying exams he'll have to take to get accepted into his Ph.D. program, and the Programming Language exams all asked the examinee to give the denotational semantics of a simple language for which the syntax was given. <p>Although I'm somewhat familiar with what it means to talk about semantics (as opposed to syntax and pragmatics), I'd definitely like to have a better understanding of how one actually gives a formal semantics of a language. <p>To this end, I did a little bit of searching, and found an out-of-print textbook entitled <a href="http://www.cis.ksu.edu/~schmidt/text/densem.html">Denotational Semantics: A Methodology For Language Development</a>. I've read through the first couple of chapters and the table of contents, and it seems like it's exactly what I was looking for. <p>So far, the introduction to the concepts has been clear, and the mathematics have been built up without too much prior knowledge expected. Some other CS theory textbooks have lost me in their heavy math from the get-go, so I'm glad my lack of experience with mathematical notation isn't holding me back on this one. Brief Bio of Donald Knuth http://lifeoflevi.com/blog/archive/2006/05/brief_bio_of_donald_knuth Wed, 17 May 2006 21:58:34 GMT People <p>Certainly one of the most revered of Computer Science's "founding fathers" is Donald Knuth, author of <a href="http://www-cs-faculty.stanford.edu/~uno/taocp.html">The Art of Computer Programming</a> and the <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html">TeX</a> document typesetting language. This month's Stanford Magazine ran a <a href="http://www.stanfordalumni.org/news/magazine/2006/mayjun/features/knuth.html">beautiful biography</a> of Knuth, which briefly outlines his personality and achievements. It's a good read, and makes me hope that he will have many more years with us. The Problem With Threads http://lifeoflevi.com/blog/archive/2006/05/the_problem_with_threads Tue, 16 May 2006 19:53:39 GMT Language-design Concurrency <p>I just read a Technical Report from UC Berkeley's EE/CS department entitled <a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.html"> The Problem With Threads</a>, which succinctly and clearly captures the problems with the concurrency mechanisms in our currently popular programming languages. It should be very readable to a lay programmer, since only a small section contains formalisms and most unfamiliar terms are defined in the text or footnotes. <p>To sum it up, threads (shared-memory concurrency) are an inappropriate method of bringing concurrency to a program because they destroy the inherent determinism of sequential programming languages. The tools we have to help deal with the nondeterminism only chip away at the combinatorial explosion of program interleavings, leaving so much opportunity for error that designing reliable and robust multithreaded software is futile. <p>The report notes that solutions to the problem that retain as much determinism as possible have existed for years, but have not caught on. The author suggests that instead of creating new programming languages, new <em>coordination</em> languages should be used to coordinate components written in familiar languages. <p>It's a very thought-provoking paper, and I think the conclusions are right on, as much as I'd like a new language to catch on. Massive concurrency is coming, and our current languages are not equipped to tackle it alone. Goedel's Famous Proof http://lifeoflevi.com/blog/archive/2006/04/goedels_famous_proof Sun, 30 Apr 2006 03:50:39 GMT History <p>Kurt Goedel shattered the hopes of mathematicians who aimed to create a comprehensive formal theory under which all true statements of mathematics could be proved by proving that such a system could not exist. This incompleteness theorem has repercussions for computer science, since a limitation on formal systems is also a limitation on computer programs. <p>Martin Herzel has provided a translation of <a href="http://www.research.ibm.com/people/h/hirzel/papers/canon00-goedel.pdf">Goedel's famous proof</a> from German to English and from Goedel's notation to more familiar contemporary notation. After reading about this proof from numerous other sources, it's great to be able to read it (almost) directly myself. Wirth's Compiler Construction http://lifeoflevi.com/blog/archive/2006/04/wirths_compiler_construction Fri, 28 Apr 2006 18:18:24 GMT Programming <p><a href="http://homepages.cwi.nl/~atanasso/ref">PLT Online</a> has added a new text to the library: Niklaus Wirth's <a href="http://www.oberon.ethz.ch/WirthPubl/CBEAll.pdf">Compiler Construction</a>. This is a remarkably short book, yet it covers the essentials of building a compiler, from lexical analysis to code generation. The source and target languages used are now pretty obscure (though they should look familiar to anyone who's seen Pascal), but the great thing about theory is that it transcends implementation details. This would be a good text for a self-study student to use as an introduction to compiling. SICP http://lifeoflevi.com/blog/archive/2006/02/sicp Mon, 13 Feb 2006 05:19:34 GMT Programming Scheme <p>I finally got around to picking up my copy of <a href="http://mitpress.mit.edu/sicp/">Structure and Interpretation of Computer Programs</a> again, and I finished reading through the first chapter, <em>Building Abstractions with Procedures</em>. I've been programming in Scheme for a while, so the language concepts were mostly review, but the presentation was enlightening. Abelson and Sussman show how procedures, and later higher-order procedures, can be used to abstract complex numerical processes into simple, clear programs. <p>The second chapter covers data abstractions, which should be interesting. I'll probably work a few more of the exercises in this chapter than I did in the first. The temptation to just keep reading is pretty strong, but the exercises are where the bulk of the learning happens. <p>I imagine most people who would read a blog explicitly about Lisp are already somewhat familiar with the book, but if by chance you are not, I highly recommend reading it. And since it is available in full online, there's no excuse not to! Markdown for Common Lisp http://lifeoflevi.com/blog/archive/2006/02/markdown_for_common_lisp Fri, 10 Feb 2006 06:09:40 GMT Lisp <p>I've finally got my implementation of the <a href="http://daringfireball.net/projects/markdown/">Markdown</a> text formatting language to a state where it's usable. It complies with almost all of the Markdown syntax specification, such as it is, and is comparable in execution time to the perl and python versions I tried it against. <p>It takes a string of Markdown-formatted text, processes it, and spits out an s-expression that can be fed into an HTML generator such as Peter Seibel's FOO (described <a href="http://www.gigamonkeys.com/book/practical-an-html-generation-library-the-interpreter.html">here</a> and part of this <a href="http://www.gigamonkeys.com/book/practicals-1.0.3.tar.gz">source package</a>). <p>I'd be interested to get feedback on it; some bug-fixes, or suggestions for stylistic improvement would be appreciated. This is only my second Common Lisp program of any size, so it's bound to be sub-optimal. If you want to try it out or take a look at it, you can <a href="http://lifeoflevi.com/markdown.lisp">download</a> it. The Art of Metaprogramming http://lifeoflevi.com/blog/archive/2006/02/the_art_of_metaprogramming Sun, 05 Feb 2006 23:37:27 GMT Programming Scheme C <p>A technique I've found very useful lately, both at work and in hobby programming, is <i>metaprogramming</i>. That is, using programs to generate other programs. At work, I generate a large amount of C data structure initialization code from a spreadsheet and a Python script. It makes updating the data trivial and integrates right into the build process, eliminating all sorts of possibilities for errors. <p>There's a series of articles on DeveloperWorks covering the Art of Metaprogramming; see <a href="http://www.ibm.com/developerworks/linux/library/l-metaprog1.html">part 1</a> and <a href="http://www.ibm.com/developerworks/linux/library/l-metaprog2.html">part 2</a>. Of course, they introduce Scheme, which is certainly one of the best languages to use for metaprogramming. Enjoy! Fun with FFI http://lifeoflevi.com/blog/archive/2006/01/fun_with_ffi Fri, 20 Jan 2006 19:11:30 GMT Scheme C <p>I recently received a task at work to implement a command-line tool that provides an interactive shell interface to a network protocol. Since the GNU Readline library provides a nice, familiar interface for that sort of thing, I looked for a high-level language I was familiar with that had readline bindings. <p>After a bit of investigation, I was unable to find one that looked usable. I did, however, discover that <a href="http://www.call-with-current-continuation.org/">Chicken Scheme</a> had an "egg" for readline integration. It didn't have all the features I needed, but it looked easily extensible. <p>The nice thing about Chicken (and a feature it shares with <a href="http://www.iro.umontreal.ca/~gambit/">Gambit</a>) is that it compiles to portable C code, so I wouldn't need an interpreter or runtime library to run the resulting application. This particular application might get distributed in the future, and we didn't want to require a relatively obscure langauge runtime to be distributed with it. <p>It turns out that adding the feature I wanted wasn't quite trivial, thanks to some lack of clarity in the readline documentation and some in the Chicken manual, but thanks to some very helpful guys on the Chicken email list, I was able to get it figured out. I highly recommend Chicken if you've got requirements similar to mine! A CS Reading List http://lifeoflevi.com/blog/archive/2006/01/a_cs_reading_list Tue, 10 Jan 2006 18:42:37 GMT Programming History Scheme Lisp <p>I just came across a list of <a href="http://www.zafar.se/bkz/antiwiki.cgi?/Home/ComputerScience/ClassicTexts/43bafac8c8570f4f">classic texts</a> in Computer Science that seems to run the gamut of CS topics. They're mostly rather old, but still very relevant. I've already read a few of them, and those ones are indeed classic, so I'm excited to read the rest when I get a chance. <p>On the same site, there is also a list of the site author's <a href="http://www.zafar.se/bkz/antiwiki.cgi?/Home/ComputerScience/FavouriteBooks/43bc70dedc4e5b21">favorite books</a>, of which I own and have at least skimmed through most. I agree that they are great books. <p>Elsewhere, there are some lecture notes by Daniel Friedman describing <a href="http://www.cs.indiana.edu/~dfried/appcont.pdf">applications of continuations</a> that look to be an interesting read. Code Synthesis http://lifeoflevi.com/blog/archive/2005/12/code_synthesis Sat, 17 Dec 2005 03:46:55 GMT Programming Scheme Language-design <p>When searching for information about techniques used to efficiently run dynamic code, I came across a <a href="http://citeseer.ist.psu.edu/massalin92synthesi.html">dissertation </a> that lines up well with the things I've been thinking about lately. It covers the design of an operating system called Synthesis, named for its technique of synthesizing optimized kernel code at run time. <p>In addition to dynamic code optimization, Synthesis uses non-locking optimistic concurrency and dynamic scheduling based on run time analysis to achieve incredible performance; by some measures, it is an order of magnitude faster than the Unix it was compared with, and it achieves the real-time scheduling necessary for multimedia work. <p>Although it was a very impressive achievement, it has since been nearly forgotten, and has now lost much of its usefulness since it was written in assembler code and the Motorola 68k architecture it targeted has fallen out of favor. The ideas seem applicable to higher-level language, though, especially Lisp-like languages in which code is easily manipulated at run time. <p>I certainly haven't the time to implement such a thing right now, but it's an intriguing idea. I think I will collect resources that might be useful for it. After all, if I continue my schooling, I'll need a dissertation topic too. The Other Fundamental Concept http://lifeoflevi.com/blog/archive/2005/12/the_other_fundamental_concept Fri, 16 Dec 2005 07:55:57 GMT Programming <p>I recently had a rather unpleasant blog discussion with someone who is attempting to design a programming environment. I was initially drawn there by references to Alan Kay and Lisp, so I was rather disappointed to find that he completely discarded the essence of Kay's philosophy and some of the key technologies that allow Smalltalk and Lisp to work. He wrote endless, rambling tirades against bytecode-based virtual machine emulators and garbage collection, and heaped praises upon the ability to program at the assembly level. <p>He completely missed another prime candidate for the fundamental concept of programming, an oft-quoted Butler Lampson aphorism: <blockquote>All problems in computer science can be solved by another level of indirection.</blockquote> <p>Coming from a man who did a significant portion of his work with computers in the 60s and 70s, when efficiency really was paramount, that ought to give an abstraction-hater pause. <p>Indirection is the key to abstraction, and abstraction is the key to programming. Throwing out useful abstractions because they're not the most efficient way possible to do something is entirely missing the point of computers. Software and Concurrency http://lifeoflevi.com/blog/archive/2005/12/software_and_concurrency Sun, 04 Dec 2005 07:08:29 GMT Programming Language-design Concurrency <p>As I was doing research for a paper, I hunted down Herb Sutter's article <a href="http://www.gotw.ca/publications/concurrency-ddj.htm">The Free Lunch Is Over: A Fundamental Turn Towards Concurrency in Software</a> to find some passages that supported my thesis. There was quite a buzz about this article when it appeared in Dr. Dobb's Journal and C/C++ Users Journal earlier this year, as it seemed to capture and clearly explain the feeling so many people had been getting while watching what the CPU manufacturers have been doing lately. Everything's going multi-core, even video game processors. <p>Following a few links, I found that Sutter has written (with James Larus) another article on the subject, this time with a greater focus on software. It's <a href="http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=332">Software and the Concurrency Revolution</a> at the ACM Queue, and it's a broad look at the deficiencies of current programming languages and practices in the face of concurrency, and what sort of changes need to be made to face the future he sees, in which individual processor cores don't get much faster than they are today. <p>I'm convinced that Sutter's take on the future is at least mostly right, and these articles ought to be required reading for anyone who wants to take up or continue writing software. Futamura Projection http://lifeoflevi.com/blog/archive/2005/11/futamura_projection Tue, 15 Nov 2005 06:00:48 GMT Programming <p>Every once in a while you come across something that just blows your mind. Having been reading textbooks and research papers on programming languages for a while, I thought I had already had most of the mind-blowing experiences to be had in that domain, but I couldn't have been more wrong. <p><a href="http://en.wikipedia.org/wiki/Partial_evaluation">Partial evaluation</a> is an optimization technique in which the compiler analyzes the program to find any static portions of code and pre-evaluate them. In the 1970s, Yoshihiko Futamura described what is now known as <a href="http://www.jadetower.org/muses/archives/000419.html">Futamura Projection</a>. There are three levels of Futamura Projection. The first takes an interpreter and a program as input and returns what is essentially a compiled version of the program. The second applies an interpreter to itself and creates a compiler for that languages. The third, and most mind-bending, takes itself twice as input and creates a compiler generator, which is a program that takes an interpreter as input and returns a compiler. <p>I have no idea yet what sort of practical use the Futamura Projection has, but it is at least a theoretically fascinating concept. Fundamental Idea of Programming http://lifeoflevi.com/blog/archive/2005/10/fundamental_idea_of_programming Fri, 28 Oct 2005 01:25:23 GMT Programming <p>According to <a href="http://en.wikipedia.org/wiki/Hal_Abelson">Hal Abelson</a> in his foreword to the book <em>Essentials of Programming Languages</em>, the most fundamental idea in computer programming is this: <blockquote>The interpreter for a computer language is just another program.</blockquote> <p>On the face of it, this seems not to apply to compiled languages, or programs written in machine code. But, upon reflection, it does. The interpreter for these languages is the microcode on the CPU, and the interpreter for the microcode is a logic program expressed in physical transistors. <p>In any case, the concept of an interpreter program is a powerful one, and is certainly worth study and mastery. As Sussman says, you will become "a designer of languages rather than only a user of languages, [ . . . ] a person who chooses the rules by which languages are put together, rather than only a follower of rules that other people have chosen." Sussman at OOPSLA http://lifeoflevi.com/blog/archive/2005/10/sussman_at_oopsla Tue, 25 Oct 2005 19:06:42 GMT Programming <p>Gerald Sussman is one of the contemporary luminaries of the field of computing, so I'm always interested to hear what he has to say. His most recent talk, delivered in San Diego last week at OOPSLA, defended the idea that programming is a good medium for expressing ideas that we don't yet fully understand. It forces us to translate from theory to practice in a methodical fashion. <p>The abstract for his talk can be found at the <a href="http://www.oopsla.org/2005/ShowEvent.do?id=403">OOPSLA site</a>, and a great <a href="http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2005-10.html#e2005-10-24T19_36_27.htm">summary and response</a> to it was written up by Eugene Wallingford at his blog, <a href="http://www.cs.uni.edu/%7Ewallingf/blog/">Knowing and Doing</a>. Analytical Engine Emulator http://lifeoflevi.com/blog/archive/2005/10/analytical_engine_emulator Wed, 12 Oct 2005 05:16:51 GMT History <p>In 1837, Charles Babbage wrote a memoir entitled <em>On the Mathematical Powers of the Calculating Engine</em>. In this paper, he described a machine, steam powered and made of brass, that would be able to store and run general-purpose programs. While it was never fully constructed, Babbage's Analytical Engine was the first computer to ever be designed. <p>Usually computer emulators are designed to mimic computers that actually existed, but fortunately for the curious, someone has put together a Java-based <a href="http://www.fourmilab.ch/babbage/applet.html">Analytical Engine Emulator</a> for the really-retro computing enthusiasts to play with. I haven't got the time nor inclination to write programs for it myself, but I think Babbage would appreciate his idea being brought to virtual fruition. <p>Speaking of programming the thing&mdash;although it was never built, it did have programs written for it. In fact, the very first was written by <a href="http://www.scottlan.edu/lriddle/women/love.htm">Ada Lovelace</a>, who thus has the distinction of being the first computer programmer. It is sadly ironic that a field pioneered by women such as Ada and <a href="http://www.sdsc.edu/ScienceWomen/hopper.html">Grace Hopper</a>, inventor of the first compiler, now finds itself with very few women practicing its arts.