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

  1. Path: sparky!uunet!bonnie.concordia.ca!cerberus.ulaval.ca!chicoutimi!vachon
  2. From: vachon@chicoutimi.gel.ulaval.ca (Pierre Vachon)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Advice on recursion?
  5. Message-ID: <1992Jul23.192749.129@cerberus.ulaval.ca>
  6. Date: 23 Jul 92 19:27:49 GMT
  7. Sender: news@cerberus.ulaval.ca
  8. Organization: Universite Laval, Ste-Foy, Quebec (Canada)
  9. Lines: 26
  10. Originator: vachon@chicoutimi
  11.  
  12. Hi,
  13.  
  14. Concerning recursive procedures, I would like to know the following:
  15.  
  16.   Are there disadvantages to using 'labels' like this:
  17.  
  18.    (defun foo (arg)
  19.      (let ((...))
  20.  
  21.        (labels ((recursive (arg1 arg2)
  22.                          (body)))
  23.          (recursive 'foo 'bar))))
  24.  
  25. I know it works, and I like the fact that it's 'clean',
  26. since the alternative would be to DEFUN the recursive part
  27. and even require some special variables, which the LET in
  28. the previous example helps me avoid...
  29.  
  30. (Of course, the recursive function is only used by FOO,
  31. which is why I like to avoid defunning (!) it on Top Level...)
  32.  
  33. So, how do YOU 'recurse'...?
  34.  
  35.  
  36. Pierre Vachon            Laboratoire de vision et systemes numeriques
  37. vachon@gel.ulaval.ca     Universite Laval, Quebec, Canada.
  38.