home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / 2090 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.1 KB  |  30 lines

  1. Path: sparky!uunet!caen!sdd.hp.com!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Advice on recursion?
  5. Date: 23 Jul 1992 23:23:18 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 18
  8. Message-ID: <14nf16INN7m0@early-bird.think.com>
  9. References: <1992Jul23.192749.129@cerberus.ulaval.ca>
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1992Jul23.192749.129@cerberus.ulaval.ca> vachon@chicoutimi.gel.ulaval.ca (Pierre Vachon) writes:
  13. >  Are there disadvantages to using 'labels' like this:
  14. >   (defun foo (arg)
  15. >     (let ((...))
  16. >       (labels ((recursive (arg1 arg2)
  17. >                         (body)))
  18. >         (recursive 'foo 'bar))))
  19.  
  20. That's precisely what LABELS is for: defining recursive or
  21. mutually-callable local functions.  Presumably the body references ARG
  22. and/or the variables bound by the LET, which is why you don't want to use a
  23. global function definition (you would have to pass them as additional
  24. arguments in that case).
  25. -- 
  26. Barry Margolin
  27. System Manager, Thinking Machines Corp.
  28.  
  29. barmar@think.com          {uunet,harvard}!think!barmar
  30.