LISP: UNEXPORT
C: Unexport
min args: 1
max args: 2
[F][CLTL]
SYNOPSIS:
unexport symbols &optional package
DESCRIPTION:
The argument should be a list of symbols, or possible a single symbol. These symbols become internal symbols in package. It is an error to unexport a symbol from the keyword package. unexport returns t.
The package argument may be either a package object or a package name.
LISP: UNINTERN
C: Unintern
min args: 1
max args: 2
[F][CLTL]
SYNOPSIS:
unintern symbol &optional package
DESCRIPTION:
If the specified symbol is present in the specified package, it is removed from that package and also from the package's shadowing-symbols list if it is present there. Moreover, if package is the home package for the symbol, the symbol is made to have no home package. Note that in some circumstances that symbol may continue to be accessible in the specified package by inheritance. unintern returns t if it actually removed a symbol, and nil otherwise.
unintern
should be used with caution. It changes the state of the package system in such a way that the consistency rules do not hold across the change.The package argument may be either a package object or a package name.
LISP: UNION
C: Lunion
min args: 2
max args: -1
[F][CLTL 15]
SYNOPSIS:
union list1 list2 &key :test :test-not :key
DESCRIPTION:
union
takes two lists and returns a new list containing everything that is an element of either of the lists. If there is a duplication between two lists, only one of the duplicate instances will be in the result. If either of the arguments has duplicate entries within it, the redundant entries may or may not appear in the result. For example:(union '(a b c) '(f a d))
=> (a b c f d) or (b c f a d) or (d f a b c) or ...
(union '((x 5) (y 6)) '((z 2) (x 4)) :key #'car)
=> ((x 5) (y 6) (z 2)) or ((x 4) (y 6) (z 2)) or ...
There is no guarantee that the order of elements in the result will reflect the ordering of the arguments in any particular way. The implementation is therefore free to use any of a variety of strategies. The result list may share cells with, or be eq to, either of the arguments if appropriate.
In general, the test may be any predicate, and the union operation may be described as follows. For all possible ordered pairs consisting of one element from list1 and one element from list2, the test is used to determine whether they "match." For every matching pair, at least one of the two elements of the pair will be in the result. Moreover, any element from either list that matches no element of the other will appear in the result. All this is very general, but probably not particularly useful unless the test is an equivalence relation.
The :test-not argument can be useful when the test function is the logical negation of an equivalence test. A good example of this is the function mismatch, which is logically inverted so that possibly useful information can be returned if the arguments do not match.
LISP: UNLESS
C: EUnless
[M][SSCL 7]
unless test {form}*
DESCRIPTION:
When a form
(unless test form1 form2 ...)
is encountered, the test is evaluated first.
If the result of the test clause is nil, then the forms in the unless body constitute an implicit progn. The forms will be evaluated from the first to the last. The value of the last one will be returned as the result of the unless form.
If the result is not nil, then no form is evaluated, and nil is returned.
NOTES:
unless
is typically used for its side effects: that is, the value of an unless form is traditionally not used.If the return value of a conditional form is relevant, then it may be stylistically more appropriate to use and or if.
Here is a quick summary of some equivalences with other conditional constructs:
(unless p x y z) == (cond ((not p) x y z))
(unless p x y z) == (if p nil (progn x y z))
(unless p x y z) == (when (not p) x y z)
LISP: UNREAD-CHAR
C: L_UnRdCh
min args: 1
max args: 2
[F][CLTL 22]
SYNOPSIS:
unread-char character &optional input-stream
DESCRIPTION:
unread-char
puts the character onto the front of input-stream. The character must be the same character that was most recently read from the input-stream. The input-stream "backs up" over this character; when a character is next read from input-stream, it will be the specified character followed by the previous contents of input-stream, unread-char returns nil.One may apply unread-char only to the character most recently read from input-stream. Moreover, one may not invoke unread-char twice consecutively without an intervening read-char operation. The result is that one may back up only by one character, and one may not insert any characters into the input stream that were not already there.
LISP: UNSIGNED-BYTE
[Typespec][CLTL 4]
SYNOPSIS:
unsigned-byte
unsigned-byte [nbits]
DESCRIPTION:
This type specifier is used either as a symbol or at the car of a type specifier list.
When used as a type specifier symbol, unsigned-byte means the set of non-negative integers.
When used in a type specifier list can optionally indicate the set of non-negative integers which can be represented in a byte of nbits bits. This is equivalent to
'(integer 0 (- (expt 2 (- nbits 1)) 1))
or
'(mod (expt 2 nbits))
nbits
must be a non-negative integer.nbits
may be unspecified either by being written as * or by omission; in this case the type specifier list indicates all non-negative integers.EXAMPLES:
(typep 2 '(unsigned-byte 8)) => t
(typep #x10 '(unsigned-byte 8)) => nil
(typep #x10 '(unsigned-byte 9)) => t
(typep 300 '(unsigned-byte *)) => t
(typep 402 '(unsigned-byte)) => t
(typep -1 'unsigned-byte) => nil
SEE ALSO:
signed-byte
LISP: UNTRACE
C: L_UnTrace
min args: 0
max args: -1
[F][CLTL 25]
SYNOPSIS:
untrace &rest function-name
DESCRIPTION:
Star Sapphire untrace is implemented as a function; the language specifies that untrace is a macro. Hence you must quote the arguments to this function whereas in other implementations you do not.
SEE ALSO:
trace.
LISP: UNWIND-PROTECT
C: EUnwProt
[S][CLTL 7]
SYNOPSIS:
unwind-protect protected-form {cleanup-form}*
DESCRIPTION:
Use unwind-protect if a form needs to be evaluated and certain side effects need to take place after the form is evaluated.
Under normal circumstances, unwind-protect just evaluates the single form protected-form; then it evaluates cleanup-form.
The interesting characteristic of unwind-protect is that cleanup-form will be evaluated irregardless of how protected-form terminates.
unwind-protect
will execute the cleanup-forms before exiting either if protected-form terminates normally or if protected-form is left prematurely. unwind-protect intercepts dynamic exit facilities such as throw as well as lexical exit facilities as go and return-from.The unwind-protect returns whatever results from evaluation of protected-form and discards all the results from the cleanup-forms.
If, however, an exit occurs during execution of the cleanup-forms, no special action is taken. The scope (so to speak) of the protection is limited to protected-form. That is, the cleanup-forms of an unwind-protect are not protected by that unwind-protect, although they may be protected if their unwind-protect occurs within the protected form of another unwind-protect.
unwind-protect
can be a key player in user-level error handling, often used in conjunction with catch and throw.For instance:
(unwind-protect (edit-a-file) (really-quit?))
neatly resolves the problem of how to get a program to exit gracefully and safely, no matter what condition produced the users' exit.
For instance, this could be part of some larger schema:
(catch 'on-exit ; edit-a-file throws here when user exits edit (setq saved-files nil) ; this flag is set if current files saved
(unwind-protect
(edit-a-file) ; the editor loop...
(if (not (saved-files)) ; ask user whether files are to be
(save-files-before-exit?)))) ; saved if they aren't.
The key thing to realize here is that the cleanup-form will be executed on the way out of the unwind-protect before the catcher is reached.
NOTES:
Note that catch, throw and unwind-protect can be bypassed by hardware or software interrupts, whether they are issued by the user (e.g. control-break) or occur abnormally (such as stack overflow or floating point errors); therefore, they are not entirely bulletproof.
LISP: UPPER-CASE-P
C: LUpCCharP
min args: 1
max args: 1
[F][CLTL 13]
SYNOPSIS:
upper-case-p char
DESCRIPTION:
The argument char must be a character object.
upper-case-p
is true if the argument is an uppercase character, and otherwise is false.If a character is either uppercase or lower-case, it is necessarily alphabetic (and therefore is graphic).
Of the standard characters (as defined by standard-char-p), the letters A through Z are uppercase.
LISP: USE-PACKAGE
C: UsePackage
min args: 1
max args: 2
[F][CLTL]
SYNOPSIS:
use-package packages-to-use &optional package
DESCRIPTION:
The packages-to-use argument should be a list of packages or package names,or possibly a single package or package name. These packages are added to the packages to us become accessible in package as internal symbols (see section 11.4). It is an error to try to use the keyword package. Use-package returns t.
The package argument may be either a package object or a package name.
LISP: UNUSE-PACKAGE
C: UnusePackage
min args: 1
max args: 2
[F][CLTL]
SYNOPSIS:
unuse-package packages-to-unuse &optional package
DESCRIPTION:
The packages-to-use' argument should be a list of packages or package names or possibly a single package or package name. These packages are removed from the use-list of package. unuse-package returns t.
The package argument may be either a package object or a package name.