Code: Select all
(defun fubar (x)
(defun feebar (y)
...)
...)
Next I tried this:
Code: Select all
;; my-reverse
(defun my-reverse (ol)
(let (foo #'(lambda (x y)
(if (equal x nil)
y
(foo (rest x) (cons (first x) y)))))
(foo ol nil)))
;Compiler warnings for "/Users/charlesparker/Code/Lisp/TryIt.lisp" :
; In MY-REVERSE: Unused lexical variable FUNCTION
;Compiler warnings for "/Users/charlesparker/Code/Lisp/TryIt.lisp" :
; In MY-REVERSE: Unused lexical variable FOO
but my-reverse seems to work:
? (my-reverse '(1 2 3))
(3 2 1)
however, so does this:
(foo '(1 2 3) nil)
(3 2 1)
I assumed locally defined functions would have similar scoping rules as locally defined variables. What's the deal?
Thanx - Charlie