Damien Kick wrote:
On Dec 4, 2006, at 19:06, Corey Sweeney wrote:
On 12/4/06, *John Quigley* <jquigley@jquigley.com
Scheme, from comp.lang.functional FAQ http://tinyurl.com/yl6gln:
[...] in (strict) functional languages such as SML or Scheme, [...] it is more common to find such programs written with an explicit loop, often expressed recursively. Nevertheless, there is still no need to update the values of the variables involved: [...]
Scheme: (define sum (lambda (from total) (if (= 0 from) total (sum (- from 1) (+ total from))))) (sum 10 0)
Most CL implementations do offer tail-call optimization, although often only when the programmer uses an optimization directive. Nonetheless, common CL coding style does not favor the ubiquitous use of recursion that Scheme style prefers -- what a Scheme programmer would express with tail recursion, a CL user would usually express with an iterative expression in do, dolist, loop, or (more recently) with the iterate package.
"Most" Common Lispniks would write an iterative, i.e. non-functional, version, such as the following:
(loop for i from 1 upto 10 summing i)
When the most exposure to lisp I had was the usual cursory intro from a comparative languages course and a intro to AI course in college, I had the impression that everything in lisp was always recursion.
My first exposure to Lisp was based on the (at the time) textbook used for the Introduction to LISP course. This book was ubiquituous at the time: "Lisp" by Winston and Horn - (at the time, 1st ed.). This book used MACLISP. There was no do - no loop - no dolist - no iterate. Everything was done in recursion.
Of course, that's not Common LISP (which was then used by "LISP" by Winston and Horn, 3rd ed.).
My understanding of tail-call recursion optimization was that it was just expected to be there and the programmer was expected to learn how to take advantage of it.
Common Lisp and Scheme do come from different communities. I think it is interesting to note that most all the many divergent lisp dialects that were used at one time http://tinyurl.com/y7puru, 3Lisp, Flavors, Franz Lisp, Interlisp, Lisp 1.5, LOOPS, XLisp, ZetaLisp, etc., have been subsumed by Common Lisp. However, Scheme remains distinct. I think that is indicative of the differences between the languages and the communities.
Scheme, in reality, is *not* a dialect of Lisp, but rather a new language. One of the biggest differences between the two is scoping: if I remember my terms right, one uses lexical scoping by default and one uses dynamic scoping. Scheme is to Lisp what Pascal is to Modula-2. Scheme is most likely best described as a Lisp descendant.
I personally would not have an issue with including many divergent dialects in the lisp family.
I agree. The more the merrier. No one's mentioned AutoLISP yet....
This is probably too big of a project, but I'll toss out the idea anyway. What about writing a common lisp "interpreter" in scheme?
Yeah, you're right. It probably *is* too big of a project.
I'm not sure how big it is - though it might be too big in Scheme. The Winston & Horn book I mentioned previously used the creation of a LISP interpreter as their last project in the book.