Node:Lisp Number Operations, Previous:Lisp support, Up:Lisp support



Lisp Number Operations

(Section numbers refer to: Guy Steel jr. "Common Lisp: The Language", second edition, 1990.)

The "Predicates on Numbers" (from Section 12.2) are all implemented.

zerop number Function
True if number is zero.

plusp number Function
True if number is positive

minusp number Function
True of number is negative

oddp integer Function
True if integer is odd.

evenp integer Function
True if integer is even.

The "Logical Operations on Numbers" (from Section 12.7) are all implemented. These all consider an integer as a semi-infinite bit string.

logior &rest integers Function
Take the "inclusive or" of the integers.

logxor &rest integers Function
Take the "exclusive or" of the integers.

logand &rest integers Function
Take the logical "and" of the integers.

logeqv &rest integers Function
Take the "exclusive nor" (bit-wise logival equivalence) of the integers.

lognand integer1 integer2 Function
Same as (lognot (logand integer1 integer2)).

lognor integer1 integer2 Function
Same as (lognot (logor integer1 integer2)).

logandc1 integer1 integer2 Function
Same as (logand (lognot integer1) integer2).

logandc1 integer1 integer2 Function
Same as (logand (lognot integer1) integer2).

logandc2 integer1 integer2 Function
Same as (logand integer1 (lognot integer2)).

logorc1 integer1 integer2 Function
Same as (logor (lognot integer1) integer2).

logorc2 integer1 integer2 Function
Same as (logor integer1 (lognot integer2)).

boole operation integer1 integer2 Function
Does the bit-wise boolean operation indicated by operation, on the two operands integer1 and integer2. The operation is one of the 16 constants below.

boole-clr Constant

boole-set Constant

boole-1 Constant

boole-2 Constant

boole-c1 Constant

boole-c2 Constant

boole-and Constant

boole-ior Constant

boole-xor Constant

boole-eqv Constant

boole-nand Constant

boole-nor Constant

boole-andc1 Constant

boole-andc2 Constant

boole-orc1 Constant

boole-orc2 Constant

lognot integer Function
Returns the bit-wise logical "not" of integer.

logtest integer1 integer2 Function
Same as (not (zerop (logand integer1 integer2))).

logbitp index integer Function
True iff bit number index in integer is one.

ash integer count Function
Does an arithmetic shift by count on integer. Shift left is count is positive; otherwise, shift right.

logcount integer Function
Count the number of 1-bits in integer, if it is non-negative. If integer is negative, count number of 0-bits.

integer-count integer Function
Return number of bits needed to represent integer.