Passing arguments to find-if
Posted: Sun Jan 18, 2015 4:04 pm
I don't understand the following compile error using CCL on Mac OSX:
I get the following error:
? (load "~/Code/Lisp/my-lib.lisp")
;Compiler warnings for "/Users/charlesparker/Code/Lisp/my-lib.lisp" :
; In LOOK-UP: Unused lexical variable FIELD-FUNC
> Error: Undefined function FIELD-FUNC called with arguments ((FOO FEE)) .
> While executing: (:INTERNAL LOOK-UP), in process Listener(4).
> Type cmd-/ to continue, cmd-. to abort, cmd-\ for a list of available restarts.
> If continued: Retry applying FIELD-FUNC to ((FOO FEE)).
> Type
for other options.
1 > q
Since field-func should be a local variable in look-up, shouldn't it be available to the lambda function?
Thanx for any help - Charlie
Code: Select all
(setf tbl '((foo fee) (flubber mcgee)))
(defun look-up (key field-func table)
(find-if #'(lambda (x)
(equal (field-func x) key))
table))
(look-up 'flubber #'first tbl)
? (load "~/Code/Lisp/my-lib.lisp")
;Compiler warnings for "/Users/charlesparker/Code/Lisp/my-lib.lisp" :
; In LOOK-UP: Unused lexical variable FIELD-FUNC
> Error: Undefined function FIELD-FUNC called with arguments ((FOO FEE)) .
> While executing: (:INTERNAL LOOK-UP), in process Listener(4).
> Type cmd-/ to continue, cmd-. to abort, cmd-\ for a list of available restarts.
> If continued: Retry applying FIELD-FUNC to ((FOO FEE)).
> Type

1 > q
Since field-func should be a local variable in look-up, shouldn't it be available to the lambda function?
Thanx for any help - Charlie