[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function-lambda-expression



Larry Mulcahy and Joerg Hoehle ask:

> Is there a way to get the function lambda expression?
> Symbol-function returns a #<CLOSURE ...> data type.  Is this a defstruct?
> If so, I'd be satisfied with the slot names.

It is a built-in type. The slots have indices, no names.
Here is an implementation of FUNCTION-LAMBDA-EXPRESSION, see CLtL2 p.682.

(defun function-lambda-expression (obj)
  (unless (sys::closurep obj)
    (error #+DEUTSCH "~: ~ ist keine Funktion."
           #+ENGLISH "~: ~ is not a function"
           'function-lambda-expression obj
  ) )
  (if (not (compiled-function-p obj))
    (values (cons 'LAMBDA (sys::%record-ref obj 1))
            (vector
                    (sys::%record-ref obj 4)
                    (sys::%record-ref obj 5)
                    (sys::%record-ref obj 6)
                    (sys::%record-ref obj 7)
                    (sys::%record-ref obj 8)
            )
            (sys::%record-ref obj 0)
    )
    (values nil t nil)
) )


                    Bruno Haible
                    haible@ma2s2.mathematik.uni-karlsruhe.de