From: Roberto Correia
Subject: letrec in LISP ?
Date: 
Message-ID: <3562f69c.17266037@pop.uvic.ca>
	Hi I was wondering if anyone out there knows how you would go
about declaring a recursive function within a let statement of some
kind? For example...

(defun palendromep (lst1)
        (flet ((helper (lsta lstb)
               (cond ((null (car lsta))
                       'T)
                     ((equal (car lsta) (car lstb))
                      (helper (cdr lsta) (cdr lstb)))
                     (t NIL))))
          (helper lst1 (reverse lst1))))
			     

	The call to the helper function within the let is invalid. 
			
				Roberto Correia

From: Scott L. Burson
Subject: Re: letrec in LISP ?
Date: 
Message-ID: <3563E8FE.7AAE88DB@zeta-sqoft.com>
Steve Gonedes wrote:
> 
> ········@gulf.uvic.ca (Roberto Correia) writes:
> 
> <       Hi I was wondering if anyone out there knows how you would go
> < about declaring a recursive function within a let statement of some
> < kind? For example...
> 
> A function defined by flet cannot see itself or any other function
> within the same flet. That is flet is a functional let, where labels
> is more like a functional let*.

I don't think it's helpful to tell people that LABELS is like LET*. 
LET* orders its bindings in a sequence, such that each binding is
available to the value expressions of all the subsequent ones.  In
contrast, all the function names bound by a given LABELS are available
to all the bodies of those functions -- it's not sequential.  One could
write an FLET* that made its bindings sequentially, but it still
wouldn't permit the definition of recursive and mutually recursive
functions, as can be done with LABELS (and LETREC in Scheme).

-- Scott

				  * * * * *

To use the email address, remove all occurrences of the letter "q".
From: Tim Bradshaw
Subject: Re: letrec in LISP ?
Date: 
Message-ID: <ey3u36jq2yw.fsf@todday.aiai.ed.ac.uk>
* Roberto Correia wrote:

> 	Hi I was wondering if anyone out there knows how you would go
> about declaring a recursive function within a let statement of some
> kind? For example...

(defun palendromep (lst1)
  (flet ((helper (f lsta lstb)
	   (cond ((null (car lsta))
		  'T)
		 ((equal (car lsta) (car lstb))
		  (funcall f f (cdr lsta) (cdr lstb)))
		 (t NIL))))
    (helper #'helper lst1 (reverse lst1))))

--tim