Hi,

I think I have uncovered an error in the way CMUCL handles lexically scoped
variables. For example, in the following code:

(defun foo (x)
    #'(lambda (y) 
        (+ x y)))

The binding of x in the lambda from should be to the argument supplied to foo. 
A call to foo should return a function that simply adds its argument to the
argument supplied to foo. For example, the call:

(funcall (foo 4) 5)

should return 9.

However, if *_before_* defining the function foo, I define a special variable x,
like:

(setf x '(1 2))

And then define foo as above, on running (funcall (foo 4) 5), I get the error:

Argument X is not a NUMBER: (1 2).

Restarts:
  0: [ABORT] Return to Top-Level.

Debug  (type H for help)

(KERNEL:TWO-ARG-+ (1 2) 5)

I don't get the same error if I declare the special variable x after defining
foo. 

Anyone have any clue about whats going on?

Thanks,
Sachin.


Reply via email to