Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] recomendations for a functional language



Curt Sampson writes:

 > implementations. (Scheme requires tail call optimization.) So that was
 > why I reckoned that CL encouraged looping rather than recursion, and why
 > I'm a little doubtful about Stephen's correction on that. But he would
 > probably know better than me.

All I meant was what you said: the language you think in determines
what you write.  If you think in Lisp, you write recursive algorithms
first, and then hand optimize to iteration if it matters.  Scheme
allows you to forget the second step.  Eg, no Lisp textbook teaches
you to write

(defun factorial (n)
  (let ((result 0))
    (loop for i from 1 to n
          do
      (setq result (* result i)))))

it teaches you to write

(defun factorial (n)
  (if (= n 1)
      n
    (* (factorial (1- n)))))

 > > >   * the Lisp-1 versus Lisp-2 distinction (which can itself be
 > > >   over-summarized as whether function variables and non-function
 > > >   variables share a namespace, but upon research it turns out to be a
 > > >   lot more subtle than that),
 > > 
 > > What kind of subtilities?

If you Google for "Lisp-1 Pitman Gabriel" you'll get a somewhat
intelligible paper that explains all the ramifications of the
difference for programming style.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links