Login

Aha! Moments in Lisp

You know, I'm a Smalltalker, but I have a deep respect for Lisp and always love reading about it. I just ran across this great thread of some Lispers talking about their big aha! moments.

One of these days soon I'm going to have to try and do a small web application in Lisp or Scheme, I love Smalltalk, but I still drool over the idea of macros and generic functions. I guess for a Lisper, Slime is the environment to learn, but I shudder at losing my Smalltalk environment and having to learn emacs. I've always felt Lisp is the superior language and Smalltalk is the superior environment. If any of you are proficient in both Lisp or Scheme and Smalltalk, I'd love to hear from you.

Comments (automatically disabled after 1 year)

Mark Miller 6333 days ago

I'm not proficient in Lisp yet, but I have come to like it, partly because it tweaks my brain to try to solve hard problems. One aha moment for me was realizing that building data structures in Lisp is super easy. The last time I really had to deal with data structures at all was in C and C++. I don't really have to deal with them in .Net, because it's got plenty of collections to do the work for me.

Anyway, I was trying to solve a problem in Lisp, using a list of course, and I realized that I was using car and cdr as methods for traversing a singly linked list, and that I had constructed that linked list by just writing it out. I didn't have to write a struct or a class. I didn't have to allocate space for each element, or traverse the list following "next" pointers. All of this was intrinsic to the language. As I thought about it, I realized I could create a binary tree or a B-tree, any data structure I wanted, out of lists. That was cool.

I've heard about closures and macros in Lisp. I haven't had a chance to recognize their power yet, but I'm looking forward to finding that out.

Ramon Leon 6332 days ago

I'm not proficient either, I just experiment for the fun of it. I've had several aha! moments in Lisp, Scheme actually, but they're always fleeting. Trying to hang onto one can be tough.

I can recall having a big aha when I realized that code itself was a traversable data structure that could be modified, macros rock. Having the language itself represented as one of the basic data structures you use in the language, is quite the mind bender.

I recall another when I realized I could use s-expressions like I'd use XML in another language, and the line between code and data suddenly disappeared.

There's also a certain aesthetic to Lisp I don't see in other languages, the code is um... pretty, and formats really well. It's the prefix notation and the parens, there's just something I really like about them. I didn't like them at first, but somehow they've grown on me. I'm definitely going to have to come up with an excuse to write a web app in Scheme soon.

Sam Griffith 6329 days ago

When Lisp is hosted on a Lisp Machine the environment you get is all that a Smalltalk system was and is... It is truely a thing to behold.

Mark Miller 6329 days ago

I got in a discussion with a developer on TechRepublic about Lisp and such, and he told me an interesting story. He said that Lisp initially was designed to use s-expressions, a syntax tree structure, with the parens and all. The Lisp community set a goal at some point in the past of upgrading Lisp to use m-expressions, where some of the parens would not be necessary, but...they never got around to it.

He made a friendly suggestion that I check out UCBLogo (Univ. of CA Berkeley Logo). He said that at its heart it's Lisp using m-expressions. Even has macros. The commands are different, of course. I never thought of Logo as a serious language. I did some stuff with it in my early teens, creating turtle graphics, but that was it. It was a good introduction to procedural programming, at least. I might check out UCBLogo someday. I'm going to see where Lisp and Smalltalk takes me first, though.

Ramon Leon 6328 days ago

Yea, I've heard the stories, but as any Lisper will attest, wanting to get rid of the parens is a right of passage one goes through, just before falling in love with them, and deciding you prefer the prefix notation with parens to any other possible syntax.

I'm not even a real Lisper, just muck with Scheme on occasion, but already I really like the parens, I like the total lack of syntax. I think Lisp/Scheme is one of the prettiest languages (visually) I've ever seen.

Dennis Watson 6312 days ago

Check out PLT scheme. http://www.plt-scheme.org/ PLT Scheme is an umbrella name for a family of implementations of the Scheme programming language. It has a very nice IDE which runs on windows, mac and linux. It has mzscheme a standards compatible RSR5 scheme interpreter. Also has many instructional books, user contributed libraries etc.

Also try lispworks http://www.lispworks.com/ for a free demo of a common lisp environment.

I think you will find an integrated environment with lisp (or scheme) as the programming language is an incredible experience on par with smalltalk.

Ramon Leon 6312 days ago

I do play with PLT Scheme, just haven't tried anything serious with it yet. I need to find some screencasts to see how schemers do web apps.

Luke Gorrie 6302 days ago

Speaking of the Lisp environment, I find the REPL-based interactive development in Guy Steele's thesis particularly inspirational. http://lambda-the-ultimate.org/classic/message4990.html if you're interested.

I'm finding it very interesting to learn Squeak coming from a Lisp/Emacs background. An early impression is that Lisp does code-is-data mostly for abstraction and code-generation (e.g. domain-specific languages) whereas Smalltalk does code-is-data for querying and updating program source code (e.g. browse senders, refactoring). I was shocked the first time Squeak had the audacity to change my source code :-)

Ramon Leon 6302 days ago

That's an interesting point, it'd hadn't occurred to me before, but thinking about it, it seems quite true.

Giles Bowkett 6289 days ago

My experience with Slime was kind of discouraging, it put me off Lisp for months. That was on Windows, I'm using DrScheme on OS X now and it's definitely more fun to play with. I'm pretty new to Lisp, haven't written anything of consequence in it, but from what I hear there's a LispSeaside out there somewhere. I've never actually seen it, don't even know what Lisp it's in, but it's probably a good way to build a web app in Lisp, and certainly a good place to begin.

Ramon Leon 6289 days ago

I watched the Slime screencast and was frankly put off by the whole environment, it's way too text and file based and I'm just spoiled by the Smalltalk environment. Neither Slime nor DrScheme's environment even come close to Squeak as far as I'm concerned.

The PLT Scheme web server (comes with DrScheme) is a continuation based server just like Seaside. I've been meaning to write a small test app in it to check it out, but haven't gotten around to it. That community seems even smaller than the Seaside community, so finding activity or sample apps is difficult. But I love the Scheme language, and having met Gerald Sussman at OOPSLA and watching him talk about it, has assured its eventual place in my toolkit. I'd totally dig flip flopping between Smalltalk and Scheme as the need arose.

David 6039 days ago

I encountered Smalltalk in the classic Byte august edition and since then I have played with them all*. I have worked in ST, C , Java and C# and much else. I have read most of the lisp and scheme classic texts - I consider myself quite able to program in Lisp. I loved Lisp and Smalltalk but working my way through "On Lisp" in 2003 I realised that what was really cool and exciting about lisp was Functional Programming... at one level I already knew this of course but it was an "aha!" moment of visceral realisation. So I went of and focused on FP, reading Bird's "An introduction to functional programming" which uses Haskell and a blizzard of papers too. I'm in love with Haskell and now both Lisp and Smalltalk seem a bit like Blub. BUT all the current environments for Lisp (and Haskell and everything else) SUCK compared to Smalltalk. I wish I could have a Squeaky Haskell.

*all the languages :)

Ramon Leon 6038 days ago

Sounds like you have quite the perspective. Having grown accustomed to the Smalltalk environment, having anything less would feel like Blub, no matter the coolness of the language.

I've glanced at Haskell a few times, but it just never seems useful for practical things, which to me, is business applications, mostly web based. I read a nice little article on defmacro a while back, but looking at the code, it just doesn't do it for me.

Having read more than a few attempted explanations of Monads, I'm starting to think Haskellers are just mentally twisted. So what is it about Haskell that Blubifies Smalltalk and Lisp, I'm truly curious?

[...] what other people have said about [...]

Peter Christensen 5884 days ago

I really liked the SLIME screencast too and I wrote a reference guide for it too. Trying to ease the pain of learning a whole new set of tools for myself and others. I included links to documentation and timestamps in the summary. That way you can find and watch the parts that interest you instead of having to sit through the whole thing.

http://www.pchristensen.com/blog/articles/reference-for-the-slimelispemacs-screencast/

-Peter

about me|good books|popular posts|atom|rss