LISP: IDENTITY
min args: 1
max args: 1
[F][CLTL 25]
SYNOPSIS:
identity object
DESCRIPTION:
The object is returned as the value of identity.
This function is the default value for the :key argument to many of the sequence functions. Many other constructs in Common LISP exhibit the behavior of identity when given a single argument, such as values. (However values returns multiple return values, whereas identity only returns the first of these values).
NOTES:
This function is defined in init0.lsp.
LISP: IF
C: SFCIf, EIf
[S][CLTL 7]
SYNOPSIS:
if test then [else]
DESCRIPTION:
The if special form is equivalent to the if-then-else construct available in most other programming languages.
A clause is selected on the basis of evaluating the test clause.
If the result of running the test is not nil, the form then is evaluated; otherwise the form else is evaluated. The if form returns the result of the evaluation of the selected clause. In this respect it is somewhat like the C ?: ternary operator.
For instance:
(if (= x 3)
(format "x is 3")
(format "x is not 3"))
will print
x is 3
if x is equal to 3 and
x is not 3
if x is not equal to 3; the return value will be nil, since that is what format returns in either case.
Essentially:
(if test then else) == (cond (test then) (t else))
however, if is considered more readable than cond in situations where only one test is to be performed.
The else form can be omitted. In this case, if the test clause evaluates to nil, no code is executed, and the if form evaluates to nil.
NOTES:
Common LISP programmers consider it traditional to use and and when instead of if in certain situations.
· If the value is not important, rather only the effect, then the when construct may be preferable.
· If an else clause is omitted and the value of the if form is important, then an equivalent and is considered preferable.
LISP: IMPORT
C: Import
min args: 1
max args: 2
[F][CLTL]
SYNOPSIS:
import symbols &optional package
DESCRIPTION:
The argument should be a list of symbols, or possibly a single symbol. These symbols become internal symbols in package and can therefore be referred to without having to use qualified-name (colon) syntax. Import signals a correctable error if any of the imported symbols has the same name as some distinct symbol already accessible in the package. import returns t.
If any symbol to be imported has no home package then import sets the home package of the symbol to the package to which the symbol is being imported.
The package argument may be either a package object or a package name.
LISP: IN-PACKAGE
C: InPackage
min args: 1
max args: 1
[F][CLTL]
SYNOPSIS:
in-package package-name &key :nicknames :use
DESCRIPTION:
The in-package function is intended to be placed at the start of a file containing a subsystem that is to be loaded into some package other than user.
If there is not already a package named package-name, this function is similar to make-package, except that after the new package is created, package is set to it. This binding will remain in force until changed by the user (perhaps with another in-package call) or until the package variable reverts to its old value at the completion of a load operation.
If there is an existing package whose name is package-name, the assumption is that the user is re-loading a file after making some changes. The existing package is augmented to reflect any new nicknames or new packages in the use list (with the usual error checking), and package is then set to this package.
LISP: INCF
min args: 1
max args: 2
[M][CLTL 12]
SYNOPSIS:
incf place [delta]
DESCRIPTION:
The number produced by the form delta is added to the number in the generalized variable named by place, and the sum is stored back into place and returned. The form place may be any form acceptable as a generalized variable to setf. If delta is not supplied, then the number in place is changed by 1.
EXAMPLES:
(setq n 0)
(incf n) => 1 and now n => 1
(decf n 3) => -2 and now n => -2
(decf n -5) => 3 and now n => 3
(decf n) => 2 and now n => 2
The effect of (incf place delta) is roughly equivalent to
(setf place (+ place delta))
except that the latter would evaluate any subforms of place twice, whereas incf takes care to evaluate them only once. Moreover, for certain place forms incf may be significantly more efficient than the setf version.
SEE ALSO:
decf.
NOTES:
This function is implemented using a macro which is loaded at initialization in defsetf.fsl. In order to use a given setf method, you must use defsetf to define that forms' setf method. If you get the message that incf does not know about a particular forms' setf method, you must edit init0.lsp and use the setf method for that form. Only the setf methods for car and cdr are loaded at startup.
LISP: INPUT-STREAM-P
C: PInputStrm
min args: 1
max args: 1
[F][CLTL 21]
SYNOPSIS:
input-stream-p stream
DESCRIPTION:
The argument to this function must be a stream object.
This predicate returns t if the stream is an input stream and nil otherwise.
LISP: INT-CHAR
C: Lint_char
min args: 1
max args: 1
[F][CLTL 13]
SYNOPSIS:
int-char integer
DESCRIPTION:
The int-char function returns a character object which is the character encoded by the given integer . See char-int.
NOTES:
This function has been eliminated from ANSI Common LISP.
LISP: INTEGER
[Typespec][CLTL 4]
SYNOPSIS:
integer [[low] high]
integer
DESCRIPTION:
This is the type specifier symbol which indicates the set of integers.
This specifier can occur either as a symbol or at the head of a type specifier list. In the latter case, optional low and high values can be specified. The low and high values can be specified as
· an integer, indicating an inclusive limit
· a list of exactly one integer, indicating an exclusive limit
or left unspecified either explicitly by writing * or by omission. If the limit is unspecified it is considered to be negative or positive infinity, for the low and high values respectively.
EXAMPLES:
(typep 3 'integer) => t
(typep 1/3 'integer) => nil
(typep 3 '(integer 0 400)) => t
(typep 3 '(integer * -44)) => nil
(typep 3 '(integer (3) 4)) => nil
(typep 4 '(integer (3) 4)) => t
LISP: INTEGER-LENGTH
C: Lintlen
min args: 1
max args: 1
[F][CLTL 12]
SYNOPSIS:
integer-length integer
DESCRIPTION:
This function performs the computation
(ceiling (log (if (integer < 0) (- 0 integer) (1+ integer))))
This is useful in two different ways. First, if integer is non- negative, then its value can be represented in unsigned binary form in a field whose width in bits is no smaller than (integer-length integer). Second, regardless of the sign of integer, its value can be represented in signed binary two's-complement form in a field whose width in bits is no smaller than (+ (integer-length integer) 1).
EXAMPLES:
(integer-length 0) => 0
(integer-length 1) => 1
(integer-length 3) => 2
(integer-length 4) => 3
(integer-length 7) => 3
(integer-length -1) => 0
(integer-length -4) => 2
(integer-length -7) => 3
(integer-length -8) => 3
LISP: INTEGERP
C: Lintegerp
min args: 1
max args: 1
[F][CLTL 6]
SYNOPSIS:
integerp object
DESCRIPTION:
integerp
is true if its argument is an integer, and otherwise is false.EXAMPLE:
(integerp x) == (typep x 'integer)
LISP: INTERN
C: Lintern
min args: 1
max args: 2
[F][CLTL 11]
SYNOPSIS:
intern string &optional package
DESCRIPTION:
The package, which defaults to the current package, is searched for a symbol with the name specified by the string argument. This search will include inherited symbols. If a symbol with the specified name is found, it is returned. If no such symbol is found, one is created and is installed in the specified package as an internal symbol (as an external symbol if the package is the keyword package); the specified package becomes the home package of the created symbol.
Two values are returned. The first is the symbol that was found or created. The second value is nil if no pre-existing symbol was found, and takes on one of three values if a symbol was found:
:internal |
The symbol was directly present in the package as an internal symbol. |
:external |
The symbol was directly present as an external symbol. |
:inherited |
The symbol was inherited via use-package (which implies that the symbol is internal). |
By convention, a call to export listing all exported symbols is placed near the start of a file to advertise which of the symbols mentioned in the file are intended to be used by other programs.
The package argument may be either a package object or a package name.
LISP: INTERNAL-TIME-UNITS-PER-SECOND
[C][CLTL]
SYNOPSIS:
internal-time-units-per-second
DESCRIPTION:
This constant is the implementation and hardware dependent number of internal time units in a second. See time and get-internal-run-time.
NOTES:
This is specified as 18.206491 in the file time.lsp.
The specification states that this number is to be chosen so that one second is evenly divided by this number. The value used in Star Sapphire is the same as the IBM PC's hardware clock.
LISP: INTERSECTION
C: Lintersection
min args: 2
max args: -1
[F][CLTL 15]
SYNOPSIS:
intersection list1 list2 &key :test :test-not :key
DESCRIPTION:
intersection
takes two lists and returns a new list containing everything that is an element of both argument lists. If either list has duplicate entries, the redundant entries may or may not appear in the result. For example:(intersection '(a b c) '(f a d)) => (a)
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 intersection 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, exactly one of the two elements of the pair will be put in the result. No element from either list appears in the result that does not match an element from the other list. All this is very general, but probably not particularly useful unless the test is an equivalence relation.
NOTES:
see nintersection.
LISP: ISQRT
C: Lisqrt
min args: 1
max args: 1
[F][CLTL 12]
SYNOPSIS:
isqrt integer
DESCRIPTION:
This function returns the integer square root of its argument. The argument must be a non-negative integer, and the result is the greatest integer less than or equal to the exact positive square root of the argument .
EXAMPLES:
(isqrt 9) => 3
(isqrt 12) => 3
(isqrt 300) => 17
(isqrt 325) => 18