CL or Scheme?
I started reading Practical Common Lisp. It took me two whole days to setup a CL system: Emacs, SLIME, CLISP, Quicklisp. The syntax is riddled with intricacies: LET or LET* or FLET or LABLES? Is Scheme (esp. Racket) any better?
Also, is newLISP based on CL, Scheme, or something else? I've had zero difficulty installing and coding it.
46 comments
[ 3.4 ms ] story [ 27.0 ms ] threadIf you want to create powerful, intricate production apps, you're probably better off with CL. It's got better libraries, a bigger community, and more history.
If, on the other hand, you're interested in learning Lisp for the purity, the "aha" moments, and to become a better programmer, I'd have to recommend Scheme. It's a lot simpler, more self-consistent, with an order of magnitude less confusing bits and "gotchas". But it's still every bit as good at showing why Lisp is awesome.
And, of course, I must mention Clojure, which aside from the JVM cruft is much "cleaner" than CL, but just as powerful and ready for production use. It's also even more intensely focused on functional programming than Scheme OR CL.
In terms of the availability of support libraries and what not, you'll find it easier with Common Lisp. Quicklisp would be the most recent (and awesome) tool that comes to mind.
In terms of the language itself, it's just more complete to me.
LET and LET* have very different uses, and while ugly, LABELS has helped me quite a fair bit, especially in porting over some recursive Haskell code.
Oh, and don't forget the wonders of LOOP =)
Other than that, I can't speak for Racket, nor any of the other Lisps out there. So take by biased opinion as a CL user for what its worth.
Neither did I, until I encountered something along the lines of:
One way to look at it is that we should use single-use functions as far as possible to keep code straightforward.
And as jpr said, LET* can potentially promote bad style, giving one the inclination to mix functional and imperative styles in a potentially troublesome fashion.
I think it was in 'On Lisp' that PG said that use of LET* should be minimised for the reasons above.
But if not, you're right. Use LET* just as you mentioned, but don't use LET* for all cases.
Some discussion available @ Stack Overflow: http://stackoverflow.com/questions/554949/let-versus-let-in-...
It's also a very elegant and beautiful language. At the end of the day, though, your customers care whether your product is beautiful, less so whether the code is beautiful.
I've never used CL.
Can you recommend a particular online learning resource? I've had a quick look at MIT's videos of their lecture series, but I've just run out of spare disk space on the laptop, so storing a few GBs of movie is out for the moment. If there's something like PCL for Scheme, that would be great.
Also, The Scheme Programming Language. http://www.scheme.com/tspl3/
http://www.scheme.com/tspl4/
1. Start with PLT Scheme/Racket. It's self contained, very well supported on all platforms, and Scheme is a leaner and cleaner language that will cause you less confusion in the beginning. This platform should be enough for you to learn Lisp and be enlightened by its idioms.
2. If in the future you plan to get serious with Lisp and write real projects in it, reconsider. You will have much more familiarity with the eco-system by then. Scheme vs. Common Lisp is a religious war of epic (= brace style) proportions, and it's not wise to get confused by it right when you start.
Now using all the available features of that combination will take a lot of time, but starting isn't really hard.
Land of Lisp, ps 16-17:
http://landoflisp.com/
"A Tale of Two Lisps
Some deep philosophical differences exist between ANSI Common Lisp and Scheme, and they appeal to different programmer personalities. Once you learn more about Lisp languages, you can decide which dialect you prefer. There is no right or wrong choice.
To aid you in your decision, I have created the following personality test for you:
A. (drawing of a mean looking wolf)
B. (drawing of a tranquil sheep)
C. (drawing of the wolf in the sheep's clothing)
If you chose A, you like raw power in your language. You don’t mind if your language is a bit ugly, due to a lot of pragmatic compromises, as long as you can still write tight code. ANSI Common Lisp is the best language for you! ANSI Common Lisp traces its ancestry most directly from the ancient Lisp dialects, built on top of millions of programmer hours, giving it incredibly rich functionality. Sure, it has some baroque function names due to countless historical accidents, but this Lisp can really fly in the right hacker’s hands.
If you chose B, you like languages that are clean and elegant. You are more interested in fundamental programming problems and are happy to while away on a beautiful meadow, contemplating the beauty of your code, occasionally writing a research paper on theoretical computing problems. Scheme is the language for you! It was created in the mid-1970s by Guy L. Steele and Gerald Jay Sussman and involved some soul-searching about the ideal Lisp. Code in Scheme tends to be slightly more verbose, since Schemers care more about mathematical purity in their code than creating the shortest programs possible.
If you chose C, you’re someone who wants it all: the power of ANSI CL and the mathematical beauty of Scheme. At this time, no Lisp dialect completely fits the bill, but that could change in the future. One language that might work for you (although it is sacrilege to make this claim in a Lisp book) is Haskell. It is not considered a Lisp dialect, but its followers obey paradigms popular among Lispers, such as keeping the syntax uniform, supporting native lists, and relying heavily on higher-order functions. More important, it has an extreme mathematical rigor (even more so than Scheme) that allows it to hide very powerful functionality under a squeaky clean surface. It’s essentially a wolf in sheep’s clothing. Like Lisp, Haskell is a language that any programmer would benefit from investigating further.
Up-and-Coming Lisps
As just mentioned, there really isn’t a true Lisp dialect available yet that possesses both the power and flexibility of ANSI Common Lisp and the elegance of Scheme. However, some new contenders on the horizon may attain the best-of-both-worlds crown in the near future.
One new Lisp that is showing promise is Clojure, a dialect developed by Rich Hickey. Clojure is built on the Java platform, allowing it to leverage a lot of mature Java libraries right out of the box. Also, Clojure contains some clever and well-thought-out features to ease multithreaded programming, which makes it a useful tool for programming seemingly ubiquitous multicore CPUs.
Another interesting challenger is Arc. It is a true Lisp language being principally developed by Paul Graham, a well-known Lisper. Arc is still in an early stage of development, and opinion varies widely on how much of an improvement it is over other Lisps. Also, its development has been progressing at a glacially slow pace. It will be a while before anyone can say if Arc might be a meaningful contender.
We’ll be dipping our toes in some Arc and Clojure in the epilogue."
newLISP isn't based on CL or Scheme, it's its own weird thing that is regarded as leprotic by the rest of the Lisp community.
There may be some libs that are in CL but not Scheme, but I actually have found nearly everything in Scheme that is in CL. Although some common real world problems are better addressed in CL related documentation.
...And you really only need emacs (or Vim, etc) and CL, Scheme, whatever installed. Setting up SLIME and all that isn't necessary to get started.
I have also tried Racket, and I was kinda disappointed. Nothing that I could particularly point my finger on, but.. it had that feeling of being a "toy".
Yes, it might also be a personality preference. I'm the kind of person that prefers Perl over Python.
It's based on the ideas of Lisp, rather than on anything more concrete. I've been able to glimpse some of the elegance that Lisp users are familiar with. It shares some Lisp DNA (hence the name), but the author's focus on code size and ease of use has moved it away from mainstream Lisp developments. It won't (and doesn't) appeal to everyone, and wouldn't be suitable for all projects, but I've found it a useful tool to have in my toolbox. At least, it helps me get my work done and I've had some fun with it too, which can't be a bad thing, can it?
http://arclanguage.org/item?id=2911
None of those decisions were made for performance reasons, but because the creator of newLisp had no idea how to do them (lexical scope and call by reference were initially performance hacks, and actually make programs faster and/or smaller.)
A better name for the language would have been newBASIC, but even Basic is garbage collected. People who intend to use newLisp really need not suffer the parentheses. The language exists in familiar form as QBasic.
Instead of comparing languages, I'd suggest you pick between implementations. This suggestion might seem odd, but the Scheme standard (R*RS) is very minimal, which imply that all major Scheme implementations contain many, many libraries and language construct not mentioned in the standard.
I my self is a Racket user, which of course makes my view biased. Here are some of the reasons Racket is the perfect choice for me:
Thanks for the link to Racket tutorial.
I guess you have to learn those. Once you understand what the * means, you can easily see the difference between any construct with and without * .
It's basically the question whether bindings are done in parallel or sequentially nested. That topic should be described in a beginners book when learning some Lisp dialect.
I would say devour everything you can lay your hands on; you wont be able to do much in computing unless you're competent in at least 4-6 languages, with a read-only knowledge of another 10 or so.
It's not languages that matter (usually) rather the computing models, development styles, and programming paradigms:
http://en.wikipedia.org/wiki/Comparison_of_programming_parad...
Each implementation has its own way of doing things. Some are simple, and some are relatively baroque. Racket is more on the baroque end, though probably less so than CL.
If you're not already familiar with Emacs, save it and Slime for later.
He really understood fexprs well. Or John Shutt's disertation. Or, this part of Alan Kay's interview: http://kazimirmajorinc.blogspot.com/2010/02/alan-kay-on-fexp...
Criticism of Newlisp? Well, yes and no - but, the point of every Lisp is, and particularly NL is - if something is missing, add it for yourself.
Picolisp is similar to Newlips, it is really minimal, very fast interpreter, written in assembler.
Other dialects have other advantages. But I'll stop here.