Chapter 12
The BuiltIn Functions
+
[Open Generic Function]
*
[Open Generic Function]

[Open Generic Function]
/
[Open Generic Function]
negative
[Open Generic Function]
floor
[Function]ceiling
[Function]round
[Function]truncate
[Function]floor/
[Function]ceiling/
[Function]round/
[Function]truncate/
[Function]modulo
[Function]remainder
[Function]^
[Open Generic Function]
abs
[Open Generic Function]
logior
[Function]logxor
[Function]logand
[Function]lognot
[Function]logbit?
[Function]ash
[Function]lcm
[Open Generic Function]
gcd
[Open Generic Function]
When instances of <rational>
and instances of <float>
are combined by a numerical function, the instance of <rational>
is first converted to an instance of <float>
of the same format as the original instance of <float>
.
odd?
[Function]Tests for the property of being an odd number.
odd? integer
⇒ boolean
An instance of <integer>
.
An instance of <boolean>
.
Returns true if its argument is an odd number.
even?
[Function]Tests for the property of being an even number.
even? integer
⇒ boolean
An instance of <integer>
.
An instance of <boolean>
.
Returns true if its argument is an even number.
zero?
[Open Generic Function]Tests for the property of being equal to zero.
zero? object
⇒ boolean
An instance of <object>
.
An instance of <boolean>
.
Returns true if its argument is equal to zero.
zero? complex
⇒ boolean
[Sealed G.F. Method]A method is defined for the class <complex>
.
positive?
[Open Generic Function]Tests for the property of being positive.
positive? object
⇒ boolean
An instance of <object>
.
An instance of <boolean>
.
Returns true if its argument is positive.
positive? real
⇒ boolean
[Sealed G.F. Method]A method is defined for the class <real>
.
negative?
[Open Generic Function]Tests for the property of being negative.
negative? object
⇒ boolean
An instance of <object>
.
An instance of <boolean>
.
Returns true if its argument is negative.
negative? real
⇒ boolean
[Sealed G.F. Method]A method is defined for the class <real>
.
integral?
[Open Generic Function]Tests for the property of being integral.
integral? object
⇒ boolean
An instance of <object>
.
An instance of <boolean>
.
Returns true if its argument is an integer.
integral? object
⇒ false
[G.F. Method]A method is defined for the class <object>
that returns #f
.
integral? real
⇒ boolean
[Sealed G.F. Method]A method is defined for real numbers that is equivalent to real = round(real)
.
+
[Open Generic Function]Returns the sum of its arguments.
object1 + object2
⇒ #rest objects
An instance of <object>
.
An instance of <object>
.
Instances of <object>
.
Adds two objects and returns the sum.
complex1 + complex2
⇒ complex
[Sealed G.F. Method]A predefined method returns the sum of two complex numbers.
*
[Open Generic Function]Returns the product of its arguments.
object1 * object2
⇒ #rest objects
An instance of <object>
.
An instance of <object>
.
Instances of <object>
.
Multiplies two objects and returns the product.
complex1 * complex2
⇒ complex
[Sealed G.F. Method]A predefined method returns the product of two complex numbers.

[Open Generic Function]Returns the difference of its arguments.
object1  object2
⇒ #rest objects
An instance of <object>
.
An instance of <object>
.
Instances of <object>
.
Subtracts object2 from object1 and returns the difference.
complex1  complex2
⇒ complex
[Sealed G.F. Method]A predefined method returns the difference of two complex numbers.
/
[Open Generic Function]Returns the quotient of its arguments.
object1 / object2
⇒ #rest objects
An instance of <object>
.
An instance of <object>
.
Instances of <object>
.
Divides object2 into object1 and returns the quotient.
complex1 / complex2
⇒ complex
[Sealed G.F. Method]A predefined method returns the quotient of two complex numbers.
Division by zero signals an error.
The result of dividing two integers with / is implementation defined. Portable programs should use floor/
, ceiling/
, round/
, or truncate/
to divide two integers.
negative
[Open Generic Function]Returns the negation of an object.
negative object1
⇒ #rest objects
An instance of <object>
.
Instances of <object>
.
Returns the negation of its argument. The unary minus operator is equivalent to a call to the negative
in the current binding environment.
negative real1
⇒ real2
[Sealed G.F. Method]A predefined method returns the additive inverse of a real number.
floor
[Function]Truncates a real number toward negative infinity.
floor real1
⇒ integer real2
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Truncates real1 toward negative infinity. The integer part is returned as integer, the remainder is returned as real2.
ceiling
[Function]Truncates a real number toward positive infinity.
ceiling real1
⇒ integer real2
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Truncates real1 toward positive infinity. The integer part is returned as integer, the remainder is returned as real2.
round
[Function]Rounds a real number toward the nearest mathematical integer.
round real1
⇒ integer real2
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Rounds real1 toward the nearest mathematical integer. The integer part is returned as integer, the remainder is returned as real2. If real1 is exactly between two integers, then the result integer will be a multiple of two.
truncate
[Function]Truncates a real number toward zero.
truncate real1
⇒ integer real2
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Truncates real1 toward zero. The integer part is returned as integer, the remainder is returned as real2.
floor/
[Function]Returns the floor of the quotient of two numbers.
floor/ real1 real2
⇒ integer real3
An instance of <real>
.
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Divides real2 into real1 and truncates the result toward negative infinity. The integer part of the result is returned as integer, the remainder is returned as real3.
ceiling/
[Function]Returns the ceiling of the quotient of two numbers.
ceiling/ real1 real2
⇒ integer real3
An instance of <real>
.
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Divides real2 into real1 and truncates the result toward positive infinity. The integer part of the result is returned as integer, the remainder is returned as real3.
round/
[Function]Rounds off the quotient of two numbers.
round/ real1 real2
⇒ integer real3
An instance of <real>
.
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Divides real2 into real1 and rounds the result toward the nearest mathematical integer. The integer part of the result is returned as integer, the remainder is returned as real3. If the result of the division is exactly between two integers, then the result integer will be a multiple of two.
truncate/
[Function]Returns the truncated quotient of two numbers.
truncate/ real1 real2
⇒ integer real3
An instance of <real>
.
An instance of <real>
.
An instance of <integer>
.
An instance of <real>
.
Divides real2 into real1 and truncates the result toward zero. The integer part of the result is returned as integer, the remainder is returned as real3.
modulo
[Function]Returns the second value of floor/
.
modulo real1 real2
⇒ real3
An instance of <real>
.
An instance of <real>
.
An instance of <real>
.
Returns the second value of floor/(real1, real2)
.
remainder
[Function]Returns the second value of truncate/
.
remainder real1 real2
⇒ real3
An instance of <real>
.
An instance of <real>
.
An instance of <real>
.
Returns the second value of truncate/(real1, real2)
.
^
[Open Generic Function]Raises an object to a specified power.
object1 ^ object2
⇒ #rest objects
An instance of <object>
.
An instance of <object>
.
Instances of <object>
.
Returns object1 raised to the power object2. An error is signaled if both arguments are zero.
complex ^ integer
⇒number
[Sealed G.F. Method]A predefined method raises a complex number to an integral power and returns the result.
abs
[Open Generic Function]Returns the absolute value of its argument.
abs object1
⇒ #rest objects
An instance of <object>
.
Instances of <object>
.
Returns the absolute value of object1.
abs complex
⇒ real
[Sealed G.F. Method]A predefined method returns the absolute value of a complex number.
logior
[Function]Returns the bitwise inclusive or of its integer arguments.
logior #rest integers
⇒ integer
Zero or more instances of <integer>
.
An instance of <integer>
.
Returns the bitwise inclusive or of the integers.
logxor
[Function]Returns the bitwise exclusive or of its integer arguments.
logxor #rest integers
⇒ integer
Zero or more instances of <integer>
.
An instance of <integer>
.
Returns the bitwise exclusive or of the integers.
logand
[Function]Returns the bitwise and of its integer arguments.
logand #rest integers
⇒ integer
Zero or more instances of <integer>
.
An instance of <integer>
.
Returns the bitwise and of the integers.
lognot
[Function]Returns the bitwise not of its integer argument.
lognot integer1
⇒ integer2
An instance of <integer>
.
An instance of <integer>
.
Returns the bitwise not of the integer1.
logbit?
[Function]Tests the value of a particular bit in its integer argument.
logbit? index integer
⇒ boolean
An instance of <integer>
.
An instance of <integer>
.
An instance of <boolean>
.
Returns true if the indexth bit in integer is a onebit; otherwise it returns false.
Negative integers are treated as if they were in two'scomplement notation.
ash
[Function]Performs an arithmetic shift on its first argument.
ash integer1 count
⇒ integer2
An instance of <integer>.
An instance of <integer>.
An instance of <integer>
.
Performs an arithmetic shift on the binary representation of integer1.
ash
shifts integer1 arithmetically left by count bit positions if count is positive, or right count bit positions if count is negative. The shifted value of the same sign as integer1 is returned.
When ash
moves bits to the left, it adds zerobits at the right. When it moves them to the right, it discards bits.
ash
is defined to behave as if integer1 were represented in two's complement form, regardless of how integers are represented by the implementation.
ash(8, 1) ⇒ 16 ash(32, 1) ⇒ 16
lcm
[Open Generic Function]Returns the least common multiple of its two arguments.
lcm object1 object2
⇒ object3
An instance of <object>
.
An instance of <object>
.
An instance of <object>
.
Returns the least common multiple of object1 and object2.
lcm integer1 integer2
⇒ integer3
[Sealed G.F. Method]A predefined method returns the least common multiple of two integers.
gcd
[Open Generic Function]Returns the greatest common divisor of its two arguments.
gcd object1 object2
⇒ object3
An instance of <object>
.
An instance of <object>
.
An instance of <object>
.
Returns the greatest common divisor of object1 and object2.
gcd integer1 integer2
⇒ integer3
[Sealed G.F. Method]A predefined method returns the greatest common divisor of two integers.