Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!amdahl!bnrmtv!wagner From: wagner@bnrmtv.UUCP Newsgroups: comp.lang.lisp Subject: scoping Message-ID: <1481@bnrmtv.UUCP> Date: Tue, 3-Mar-87 18:16:14 EST Article-I.D.: bnrmtv.1481 Posted: Tue Mar 3 18:16:14 1987 Date-Received: Fri, 6-Mar-87 21:05:58 EST Organization: Bell Northern Research, Mtn. View, CA Lines: 23 ExperTelligence's common lisp produces a bug with the following code. I *believe* that it's a bug but the nuances of common lisp scoping, extent, etc are sometimes confusing. If anyone can provide additional insight I would appreciate it. ;a function for summing the results of applying a function ;to each element of a list. (defun sum (fn lst) (apply #'+ (mapcar fn lst))) ;calls sum with a function which multiplies i by the argument (n) (defun test (i) (sum #'(lambda (n) (* i n)) '(1 2 3))) ;call test with 2 (test 2) => error, i is bound to nil inside the unnamed lambda It seems to me that i should be bound to 2. Thanx in advance, Mark Wagner @ BNR