LOCALLY(3cl) |
Common Lisp Reference |
LOCALLY(3cl) |
NAME
locally – sequentially evaluate forms in lexical environment with declarations (special operator)
SYNOPSIS
locally
|
ARGUMENTS and VALUES
declare expression; not evaluated. —a
progn. —an implicit
—the values of the s.
VALID CONTEXT
n/a
BINDING TYPES AFFECTED
n/a
DESCRIPTION
Sequentially evaluates a body of s in a lexical environment where the given s have effect.
AFFECTED BY
(none)
EXCEPTIONAL SITUATIONS
(none)
NOTES
The special declaration may be used with locally to affect references to, rather than bindings of, variables.
If a locally form is a top level form, the body s are also processed as top level forms.
EXAMPLES
(
defun
(
)
; this y is regarded as special
(
declare
(
special
))
(
let
((
))
; this y is regarded as lexical
(
list
(
locally
(
declare
(
special
))
;; this next y is regarded as special
))))
(
nil
)
(
T NIL
)
(
setq
’(
1 2 3
)
’(
4
.
5
))
(
4
.
5
)
;;; The following declarations are not notably useful in
;;; specific. They just offer a sample of valid declaration
;;; syntax using LOCALLY.
(
locally
(
declare
(
inline floor
) (
notinline car cdr
))
(
declare
(
optimize space
))
(
floor
(
car
)
(
cdr
)))
0
,
1
;;; This example shows a definition of a function that has
;;; a particular set of OPTIMIZE settings made locally to
;;; that definition.
(
locally
(
declare
(
optimize
(
safety
3
) (
space
3
) (
speed
0
)))
(
defun
(
&optional
(
(
)))
(
)))
;;; This is like the previous example, except that the
;;; optimize settings remain in effect for subsequent
;;; definitions in the same compilation unit.
(declaim (optimize (safety 3) (space 3) (speed 0)))
(defun ( &optional ( ()))
())
SEE ALSO
declare(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 Friday 17 March 2017.