Monday, October 10, 2005

 

Common Lisp and/or Scheme, and Y I should bother

First things first. If there's a Y pun, then you know I must be talking about the Y combinator. Understanding it is on the computer science part of the ol' "Things to do before I die" list. To that end, I got and read "The Little Schemer", and had the same reaction I usually get when reading about the Y combinator, or continuations (another on my "to understand" list). It starts out very simple (cons, car cdr), adds a baby step, another baby step, etc. then they're off on this bizarro explanation that makes no sense to me. Instead of steps A, B, C, D, E, F it's more like A, B, C, W, X, Y; there were some important steps in between that I somehow missed. Is this something I need to eventually conquer to achieve enlightenment, or are they happy, productive Lispers out there who don't understand this?

A related question is Common Lisp and Scheme, specifically PLT Scheme. I've looked at both and prefer Common Lisp to get work done, using emacs and SLIME. Every now and then I look at PLT Scheme, mainly out of IDE envy, and it looks nice. Bill Clementson says it's the best Open Source Lisp. Common Lisp vs. PLT Scheme reminds me of the "even though Python is a better language, Java + IDE combos make you more productive" blog entries I see.

Everyone says the best tool for the job, but for Lisp users I'm thinking that's usually either Common Lisp or Scheme, and other non-Lisp languages. Do Lisp users just stick with one dialect of Lisp, or are there people that use Common Lisp and Scheme for different tasks?

Labels: ,


Comments:
are you a visual thinker?

I never used to understand continuations
until I heard "Heap allocated" environments
and this - diagram

now, Y combiners (I have TLS also) ? are they trying to prove -

- you can do State (loops) with Computation (recursion) ?
- does this tie in with some kind of Turing equivance proof ?
 
Schemers seem to be obscurantists. Try this link for a down-to-earth explanation of continuations:

ftp://ftp.cs.utexas.edu/pub/garbage/cs345/schintro-v14/schintro_toc.html

It's an explanation of another commenter's "heap-allocated stack frames," and is far more coherent and useful than much of the "future computation" drivel I've been subjected to.
 
For the Y combinator, may I suggest you read Richard Gabriel's paper : "The Why of Y ".
It's on his site www.dreamsongs.com, click on "essays". Start at the bottom of page 2 "The basic form of the factorial function is the....". From then, Y is derived. I think it worked for me once :)
 
Speaking for myself, I understand the Y combinator but have never once used it for anything outside of exercises.

And I stick with CL.
 
I prefer Scheme, but I could see myself using Common Lisp for its better libraries and more mature implementations (but I'm not using CL at the moment). I really can't think of any reason for someone who prefers CL to use Scheme, although it's always good to learn a new perspective.
 
I currently use Common Lisp for developing applications and Scheme for learning and investigating programming language concepts.

I don't think there's a lot of use for the Y combinator, so you could probably get along just fine without learning exactly how it works. However, it's very cool that you can write a recursive function without naming it, even if you're rarely going to want to do it.

Whether or not you should bother depends entirely upon whether you're interested enough to persue such things! The 'aha' experience when you first 'get' things like continuations or the Y combinator is its own reward.
 
anonymous1,

I like the word 'obscurantists' - I think it sums up a lot of the schemers very well.

anonymous2,

I tried "the Why of Y" and had much the same reaction as to "The Little Schemer". For now I'll just try to lead a rich and fulfilling life without knowing it.

We had one commenter that uses both, but even he just uses CL for applications. I think the consensus here is that the richness of CL as a language and supporting libraries ovecomes the nicer IDE of PLT Scheme (which I think is the nicest of the Scheme IDEs).
 
Those interested in this topic may wish to have a look at the higher-level comments at Yearning for a practical scheme
 
Preferring Scheme is not about a nice IDE. Only PLT Scheme has one, and many PLT users prefer Emacs. With any other Scheme, it's the other way around - you give up SLIME for a decidedly inferior environment when you use Scheme. And yet some still prefer (non-PLT) Scheme.
 
Let me amend my previous comment. Perhaps the main reason I use Common Lisp for applications instead of Scheme is that I started writing applications with it first. And let me also note that I haven't been using either Scheme or Common Lisp for very long.

I don't think Scheme is unsuitable for writing applications, especially when you get to control the platform you build on and you don't worry about portability to other Schemes. I wouldn't use PLT's DrScheme environment for developing an application; it's a great learning tool, though.

For writing OS glue apps in Unix, scsh (Scheme Shell) would be an obvious choice, even over Common Lisp. Some Schemes have pretty advanced web programming features, like PLT and SISC. I don't think either Scheme or Common Lisp has a clear win over the other as far as having tools available to build things; it's a matter of choosing based on what you want to do and what 'clicks' with you.
 
sBeUBa Your blog is great. Articles is interesting!
 
YjXgq8 Thanks to author.
 
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
 
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
 
Please write anything else!
 
actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?