[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Single Page

Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [8] Sorting with AutoLISP
Next Document: [10] Iteration with MAPCAR,...


[9] Recursion


  This is not an often asked question but a very interesting one,
  because LISP itself is defined recursively and it's often the
  easiest way to articulate hard problems.

  There some fine documents about recursion at
  http://xarch.tu-graz.ac.at/autocad/lisp/ especially the
  http://xarch.tu-graz.ac.at/autocad/lisp/recursive.html tutorial by
  Dennis Shinn.

  It explains in great detail:

  (defun fact (n)
    (cond
      ((zerop n) 1)
      (T (* n (fact (1- n))))))

  Note: There's also a self-modifying example of this function
  explained at http://xarch.tu-graz.ac.at/autocad/lisp/self-mod.lsp



Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [8] Sorting with AutoLISP
Next Document: [10] Iteration with MAPCAR,...

Part1 - Part2 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
rurban@xarch.tu-graz.ac.at (Reini Urban)

Last Update October 22 2009 @ 05:22 AM

Some parts © 2009 Advameg, Inc.