4.6 Reference Pages

4.6.4 Miscellaneous

arglist Function

Syntax:arglist function

The functionarglist returns a list that describes the arguments to a function.

The function argument can be a function object or a symbol. If the argument is a function or a symbol that has a function definition, a list that describes the arguments of the function is returned. Otherwise, an error is signaled.

> (defun multiply (x y)
    (* x y))
MULTIPLY

> (arglist 'multiply) (X Y)

> (defun new-multiply (x y) (declare (arglist factor1 factor2)) (* x y)) NEW-MULTIPLY

> (arglist 'new-multiply) (FACTOR1 FACTOR2)

describe Function

Syntax:describe object&optional output-stream

The functiondescribe prints information about a specified object. The optional output-stream argument specifies which output stream the object should be read from. It defaults to the standard output. The functiondescribe returns no values.

The standard output is defined by the value of the Common Lisp variable*standard-output*.

> (describe 12)
Twelve is a fixnum.
 Binary 1100, Octal 14, Decimal 12, Hex C, Roman XII

> (describe '-) - is a symbol. Its home package is LISP. It is proclaimed special. Its global value is (DESCRIBE (QUOTE -)). Its global function definition is #<Compiled-Function - 166B17>. #<Compiled-Function - 166B17> is a compiled function. Its argument list is (NUMBER &REST MORE-NUMBERS). The code for this function is 276 bytes long. - has an inline definition known to the compiler.

> (describe (make-array 3)) #<Simple-Vector T 3 630DF3> is a simple vector. It has 3 elements.

> (describe *package*) #<Package "USER" 357B53> is the USER package. It uses the LISP and LIQUID-COMMON-LISP packages. It has no external symbols and no shadowed symbols.

See Also:inspect,describe-object (in The Common Lisp Object System)

grindef
Macro

Syntax:grindef&rest function-name

The macrogrindef pretty-prints the source code associated with the name of an interpreted function. The macrogrindef returns no values.

The function-name argument is not evaluated.

> (defun grist (x y)
    (let ((a 1) (b 2) (c 3))
      (+ x a b c)))
GRIST

> (grindef grist) (DEFUN GRIST (X Y) (LET ((A 1) (B 2) (C 3)) (+ X A B C)))

source-code Function

Syntax:source-code function-or-method

The functionsource-code returns the source code of an interpreted function or method.

The function-or-method argument can be a function object, a symbol, a method object, or a method name. If the argument is an interpreted function or a symbol that has a function definition that is an interpreted function, the source code of the function is returned. If the argument is a method object or a method name, the source code of the method is returned. Otherwise,source-code returnsnil.

A method name has the following form:

(method generic-function-name {qualifiers}* ({specializer-name}*))

> (source-code #'car)
NIL

> (source-code #'(lambda (x) (1+ x))) (LAMBDA (X) (1+ X))

> (defun ink (x) (1+ x)) INK

> (source-code #'ink) (NAMED-LAMBDA INK (X) (BLOCK INK (1+ X)))

;;; Define the method ADD-ONE and create its associated ;;; generic function. > (defmethod add-one ((x number)) (+ x 1)) #<Standard-Method ADD-ONE (NUMBER)>

> (source-code '(method add-one (number))) (LAMBDA (X) (DECLARE (IGNORE X) (CLASS X NUMBER)) (BLOCK ADD-ONE (+ X 1)))

See Also: grindef


The User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker