(defparameter *objects* '(whiskey bucket frog chain))
(defparameter *object-locations* '((whiskey living-room)
(bucket living-room)
(chain garden)
(frog garden)))
(defun objects-at (loc objs obj-locs)
(labels ((at-loc-p (obj)
(eq (cadr (assoc obj obj-locs)) loc)))
(remove-if-not #'at-loc-p objs)))
(objects-at 'living-room *objects* *object-locations*)
在REPL中返回(WHISKEY BUCKET)
。CL - 如何將obj參數傳遞給標籤函數?
obj
如何進入at-loc-p
? objects-at
的參數都沒有名爲obj
。
Doooh,沒有注意到它用objs作爲標籤後面的參數調用該函數。感謝您的簡要解釋。 – deadghost