COMPILE(3cl) |
Common Lisp Reference |
COMPILE(3cl) |
NAME
compile – compile an interpreted function (function)
SYNOPSIS
|
ARGUMENTS and VALUES
nil — a function name, or
nil. —a lambda expression or a function. The default is the function definition of if it names a function, or the macro function of if it names a macro. The consequences are undefined if no definition is supplied when the name is
—the function-name, or a compiled function.
—a generalized boolean.
—a generalized boolean.
DESCRIPTION
Compiles an interpreted function.
compile produces a compiled function from . If the definition is a lambda expression, it is coerced to a function. If the definition is already a compiled function, compile either produces that function itself (i.e., is an identity operation) or an equivalent function.
If the name is nil, the resulting compiled function is returned directly as the primary value.
If a non-nil name is given, then the resulting compiled function replaces the existing function definition of name and the name is returned as the primary value; if name is a symbol that names a macro, its macro function is updated and the name is returned as the primary value.
Literal objects appearing in code processed by the compile function are neither copied nor coalesced . The code resulting from the execution of compile references objects that are eql to the corresponding objects in the source code.
compile is permitted, but not required, to establish a handler for conditions of type error. For example, the handler might issue a warning and restart compilation from some implementation-dependent point in order to let the compilation proceed without manual intervention.
The secondary value, , is false if no conditions of type error or warning were detected by the compiler, and true otherwise.
The tertiary value, , is false if no conditions of type error or warning (other than style-warning) were detected by the compiler, and true otherwise.
AFFECTED BY
*error-output*, *macroexpand-hook*.
The presence of macro definitions and proclamations.
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.
NOTES
(none)
EXAMPLES
(
defun
foo
()
"bar"
)
FOO
(
compiled-function-p
#’
foo
)
implementation-dependent
(
compile
’
foo
)
FOO
(
compiled-function-p
#’
foo
)
true
(
setf
(
symbol-function
’
foo
)
(
compile
nil
’(
lambda
()
"replaced"
)))
#<
Compiled-Function
>
(
foo
)
"replaced"
SEE ALSO
compile-file(3cl)
AUTHOR and COPYRIGHT
Substantial portions of this page are taken from draft proposed American National Standard for Information Systems—Programming Language—Common Lisp, X3J13/94-101R, Version 15.17R, Fri 12-Aug-1994 6:35pm EDT; no copyright indicated.
Additional clarification and comments by Michael Marking <marking@tatanka.com>, http://www.tatanka.com/software/cl-manpages/; alternatively, https://github.com/wakinyantanka/cl-manpages/. Copyright 2017 Michael Marking as both an original and a derivative work.
Licensed under Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0).
This page last revised Sunday 26 February 2017.