Subject: Re: What's the point of flet?
From: Erik Naggum <erik@naggum.net>
Date: Wed, 31 Oct 2001 22:01:34 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3213554492332963@naggum.net>

* Vebjorn Ljosa <abuse@ljosa.com>
| But it also makes the parts impossible to test separately.

  You may simply need a better Common Lisp environment.

  Suppose you have this silly function:

(defun foo ()
  (flet ((bar () t))
    (bar)))

  In Allegro CL, this defines two functions reachable with fdefinition: one
  named by the symbol foo, and one named by the list (flet foo bar).  That
  is, #'(flet foo bar) returns the inner function bar.  If this is not a
  closure, it is funcallable.

(funcall #'(flet foo bar))
=> t

  You can trace inner functions and use these function names in a number of
  interesting places.  I think this is a very useful and intelligent
  extension to the function name concept, given that it has to be supported
  for setf methods.

///
-- 
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
-- 
  Carrying a Swiss Army pocket knife in Oslo, Norway, is a criminal offense.