This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

compiled-function-p on closures

2 posts · 1019 views

Hi there,

Look at this:

(defun foo (x) x)
(compile 'foo)
(compiled-function-p #'foo) ; => T

But:

(let ((y 2))
(defun foo (x) (* x y)))
(compile 'foo)
(compiled-function-p #'foo) ; => NIL

Shouldn't its value be T?

System: CCL-1.6

Re: compiled-function-p on closures

Well, the Hyperspec for COMPILE says:
Hyperspec wrote:Exceptional Situations:

The consequences are undefined if the lexical environment surrounding the function to be compiled contains any bindings other than those for macros, symbol macros, or declarations.
I never noticed that before. SBCL gives T here.