Macro EXT:THE-ENVIRONMENT
. As in Scheme, the macro (
returns the current lexical environment. This works only in interpreted code and
is not compilable!EXT:THE-ENVIRONMENT
)
Function (EXT:EVAL-ENV
. evaluates a form in a given lexical environment, just as if the
form had been a part of the program that the form
&OPTIONAL
environment
)environment
came from.
DEFINE-SYMBOL-MACRO
The macro DEFINE-SYMBOL-MACRO
establishes SYMBOL-MACRO
s with
global scope (as opposed to SYMBOL-MACRO
s defined with
SYMBOL-MACROLET
, which have local scope).
The function
EXT:SYMBOL-MACRO-EXPAND
tests for a SYMBOL-MACRO
: If symbol
is defined as a SYMBOL-MACRO
in the global environment, (
returns two
values, EXT:SYMBOL-MACRO-EXPAND
symbol
)T
and the expansion; otherwise it returns NIL
.
EXT:SYMBOL-MACRO-EXPAND
is a special case of MACROEXPAND-1
. MACROEXPAND-1
can also test whether a symbol is defined as a SYMBOL-MACRO
in lexical environments
other than the global environment.
“Undefined variables”, i.e. variables which are
referenced outside any lexical binding for a variable of the same name
and which are not declared SPECIAL
, are treated like dynamic variables
in the global environment. The compiler SIGNAL
s a WARNING
when it
encounters an undefined variable.
Lists of the form ((
are also
treated as function forms. This makes the syntax
SETF
symbol
) ...)(
consistent with the syntax
function-name
arguments
...)(
.
It implements the item 7 of the [ANSI CL standard] issue FUNCTION-NAME:LARGE and the
definition of function forms,
and is consistent with the use of function names elsewhere in Common Lisp.
FUNCALL
#'function-name
arguments
...)
EVAL-WHEN
EVAL-WHEN
also accepts the situations (NOT EVAL)
and (NOT COMPILE)
.
The situations EVAL
,
LOAD
and COMPILE
are
deprecated by the [ANSI CL standard], and they are not equivalent to the new
standard situations :EXECUTE
,
:LOAD-TOPLEVEL
and :COMPILE-TOPLEVEL
in that they ignore the
top-level form versus non-top-level form distinction.
THE
The special form (
is
similar to THE
value-type
form
)CHECK-TYPE
but does a type check only in interpreted
code (no type check is done in compiled code - but see the EXT:ETHE
macro) and does not allow interactive error correction by the user.
Constant LAMBDA-LIST-KEYWORDS
. (
&OPTIONAL
&REST
&KEY
&ALLOW-OTHER-KEYS
&AUX
&BODY
&WHOLE
&ENVIRONMENT
)
SYMBOL-FUNCTION
(
requires SETF
(SYMBOL-FUNCTION
symbol
) object
)object
to be either a FUNCTION
, a SYMBOL-FUNCTION
return value, or a lambda expression. The lambda expression is thereby
immediately converted to a FUNCTION
.
DEFUN
and DEFMACRO
are allowed in non-toplevel positions. As
an example, consider the old ([CLtL1]) definition of GENSYM
:
(let ((gensym-prefix "G") (gensym-count 1)) (defun gensym (&optional (x nil s)) (when s (cond ((stringp x) (setq gensym-prefix x)) ((integerp x) (if (minusp x) (error "~S: index ~S is negative" 'gensym x) (setq gensym-count x))) (t (error "~S: argument ~S of wrong type" 'gensym x)))) (prog1 (make-symbol (concatenate 'string gensym-prefix (write-to-string gensym-count :base 10 :radix nil))) (incf gensym-count))))
See also Section 3.2.2.2, “Minimal Compilation ”.
Function EXT:ARGLIST
. Function (
returns the lambda list of
the function or macro that EXT:ARGLIST
name
)name
names and SIGNAL
s an ERROR
if name
is
not FBOUNDP
. It also SIGNAL
s an ERROR
when the macro lambda list is not
available due to the compiler optimization settings
(see Section 3.3.6, “Declaration SPACE
”).
Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*
. When CUSTOM:*SUPPRESS-CHECK-REDEFINITION*
is NIL
,
CLISP issues a WARNING
when a function (macro, variable, class,
etc) is redefined in a different file than its original definition.
It is not a good idea to set this variable to T
.
Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*
. When CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*
is
non-NIL
, DEFUN
accepts specialized lambda lists, converting type-parameter
associations to type declarations:
(defun f ((x list) (y integer)) ...)
is equivalent to
(defun f (x y) (declare (type list x) (type integer y)) ...)
This extension is disabled by -ansi
and by setting CUSTOM:*ANSI*
to T
,
but can be re-enabled by setting CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*
explicitly.
These notes document CLISP version 2.49 | Last modified: 2010-07-07 |