about inner function

Discussion of Common Lisp

about inner function

Postby andyqu » Fri May 11, 2012 1:29 am

Can an inner function B, which is inside function A, access variables of A? I searched on google, but found little information about this
:? :? :?
Posts: 1
Joined: Wed May 02, 2012 4:39 am

Re: about inner function

Postby nuntius » Fri May 11, 2012 8:29 am

Try the following in a CL implementation.

Code: Select all
(defun test (x)
  (let ((a 2))
    (flet ((f (y) (+ a y x)))
      (f x))))
User avatar
Posts: 532
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 9 guests