12 The Built-In Functions

`<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.

**Signature:**-
`odd?`

*integer*Þ*boolean* **Arguments:**-
*integer*An instance of`<integer>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is an odd number.

`even?`

[Function]Tests for the property of being an even number.

**Signature:**-
`even?`

*integer*Þ*boolean* **Arguments:**-
*integer*An instance of`<integer>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is an even number.

`zero?`

[Open Generic Function]Tests for the property of being equal to zero.

**Signature:**-
`zero?`

*object*Þ*boolean* **Arguments:**-
*object*An instance of`<object>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is equal to zero.

`<complex>`

.`positive?`

[Open Generic Function]Tests for the property of being positive.

**Signature:**-
`positive?`

*object*Þ*boolean* **Arguments:**-
*object*An instance of`<object>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is positive.

`positive?`

real Þ boolean [G.F. Method]`<real>`

.`negative?`

[Open Generic Function]Tests for the property of being negative.

**Signature:**-
`negative?`

*object*Þ*boolean* **Arguments:**-
*object*An instance of`<object>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is negative.

`<real>`

.`integral?`

[Open Generic Function]Tests for the property of being integral.

**Signature:**-
`integral?`

*object*Þ*boolean* **Arguments:**-
*object*An instance of`<object>`

. **Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if its argument is an integer.

`<object>`

which returns `#f`

.` = round(real)`

`+`

[Open Generic Function]Returns the sum of its arguments.

**Signature:**-
*object1*Þ`+ object2`

`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

.*object2*- An instance of
`<object>`

.

**Values:**-
*objects*Instances of`<object>`

. **Description:**- Adds two objects and returns the sum.

`+`

complex2 Þ complex [G.F. Method]`*`

[Open Generic Function]Returns the product of its arguments.

**Signature:**-
*object1*`*`

*object2*Þ`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

.*object2*- An instance of
`<object>`

.

**Values:**-
*objects*Instances of`<object>`

. **Description:**- Multiplies two objects and returns the product.

`*`

complex2 Þ complex [G.F. Method]

`-`

[Open Generic Function]Returns the difference of its arguments.

**Signature:**-
*object1*Þ`- object2`

`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

.*object2*- An instance of
`<object>`

.

**Values:**-
*objects*Instances of`<object>`

. **Description:**- Subtracts
*object2*from*object1*and returns the difference.

`-`

complex2 Þ complex [G.F. Method]`/`

[Open Generic Function]Returns the quotient of its arguments.

**Signature:**-
*object1*`/`

*object2*Þ`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

.*object2*- An instance of
`<object>`

.

**Values:**-
*objects*Instances of`<object>`

. **Description:**- Divides
*object2*into*object1*and returns the quotient.

`/`

complex2 Þ complex [G.F. Method]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.

**Signature:**-
`negative`

*object1*Þ`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

. **Values:**-
*objects*Instances of`<object>`

. **Description:**- 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`floor`

[Function]Truncates a real number towards negative infinity.

**Signature:**-
`floor`

*real1*Þ*integer real2* **Arguments:**-
*real1*An instance of`<real>`

. **Values:**-
*integer*An instance of`<integer>`

.*real2*- An instance of
`<real>`

.

**Description:**- Truncates
*real1*towards negative infinity. The integer part is returned as*integer*, the remainder is returned as*real2*.

`ceiling`

[Function]Truncates a real number towards positive infinity.

**Signature:**-
`ceiling`

*real1*Þ*integer real2* **Arguments:**-
*real1*An instance of`<real>`

. **Values:**-
*integer*An instance of`<integer>`

.*real2*- An instance of
`<real>`

.

**Description:**- Truncates
*real1*towards positive infinity. The integer part is returned as*integer*, the remainder is returned as*real2*.

`round`

[Function]Rounds a real number towards the nearest mathematical integer.

**Signature:**-
`round`

*real1*Þ*integer real2* **Arguments:**-
*real1*An instance of`<real>`

. **Values:**-
*integer*An instance of`<integer>`

.*real2*- An instance of
`<real>`

.

**Description:**- Rounds
*real1*towards towards the nearest mathematical integer. The integer part is returned as*integer*, the remainder is returned as*real2*.

`truncate`

[Function]Truncates a real number towards zero.

**Signature:**-
`truncate`

*real1*Þ*integer real2* **Arguments:**-
*real1*An instance of`<real>`

. **Values:**-
*integer*An instance of`<integer>`

.*real2*- An instance of
`<real>`

.

**Description:**- Truncates
*real1*towards 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.

**Signature:**-
`floor/`

*real1 real2*Þ*integer real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*integer*An instance of`<integer>`

.*real3*- An instance of
`<real>`

.

**Description:**- Divides
*real2*into*real1*and truncates the result towards 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.

**Signature:**-
`ceiling/`

Þ*real1 real2**integer real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*integer*An instance of`<integer>`

.*real3*- An instance of
`<real>`

.

**Description:**- Divides
*real2*into*real1*and truncates the result towards 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.

**Signature:**-
`round/`

Þ*real1 real2**integer real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*integer*An instance of`<integer>`

.*real3*- An instance of
`<real>`

.

**Description:**- Divides
*real2*into*real1*and rounds the result towards the nearest mathematical integer. The integer part of the result is returned as*integer*, the remainder is returned as*real3*.

`truncate/`

[Function]Returns the truncated quotient of two numbers.

**Signature:**-
`truncate/`

Þ*real1 real2**integer real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*integer*An instance of`<integer>`

.*real3*- An instance of
`<real>`

.

**Description:**- Divides
*real2*into*real1*and truncates the result towards 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/`

.

**Signature:**-
`modulo`

Þ*real1 real2**real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*real3*An instance of`<real>`

. **Description:**- Returns the second value of floor/(real1 , real2).

`remainder`

[Function]Returns the second value of

`truncate/`

.

**Signature:**-
`remainder`

Þ*real1 real2**real3* **Arguments:**-
*real1*An instance of`<real>`

.*real2*- An instance of
`<real>`

.

**Values:**-
*real3*An instance of`<real>`

. **Description:**- Returns the second value of truncate/(real1 , real2).

`^`

[Open Generic Function]Raises an object to a specified power.

**Signature:**-
*object1*Þ`^ object2`

`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

.*object2*- An instance of
`<object>`

.

**Values:**-
*objects*Instances of`<object>`

. **Description:**- Returns object1 raised to the power object2.

`abs`

[Open Generic Function]Returns the absolute value of its argument.

**Signature:**-
`abs`

Þ*object1*`#rest`

*objects* **Arguments:**-
*object1*An instance of`<object>`

. **Values:**-
*objects*Instances of`<object>`

. **Description:**- Returns the absolute value of
*object1*.

`abs`

complex1 Þ complex [G.F. Method]

`logior`

[Function]Returns the bitwise inclusive or of its integer arguments.

**Signature:**-
`logior #rest`

Þ*integers**integer* **Arguments:**-
*integers*Zero or more instances of`<integer>`

. **Values:**-
*integer*An instance of`<integer>`

.. **Description:**- Returns the bitwise inclusive or of the
*integers*.

`logxor`

[Function]Returns the bitwise exclusive or of its integer arguments.

**Signature:**-
`logxor #rest`

Þ*integers**integer* **Arguments:**-
*integers*Zero or more instances of`<integer>`

. **Values:**-
*integer*An instance of`<integer>`

. **Description:**- Returns the bitwise exclusive or of the
*integers*.

`logand`

[Function]Returns the bitwise and of its integer arguments.

**Signature:**-
`logand #rest`

Þ*integers**integer* **Arguments:**-
*integers*Zero or more instances of`<integer>`

. **Values:**-
*integer*An instance of`<integer>`

. **Description:**- Returns the bitwise and of the
*integers*.

`lognot`

[Function]Returns the bitwise not of its integer argument.

**Signature:**-
`lognot`

Þ*integer1**integer2* **Arguments:**-
*integer1*An instance of`<integer>`

. **Values:**-
*integer2*An instance of`<integer>`

. **Description:**- Returns the bitwise not of the
*integer1*.

`logbit?`

[Function]Tests the value of a particular bit in its integer argument.

**Signature:**-
`logbit?`

Þ*index integer**boolean* **Arguments:**-
*index*An instance of`<integer>`

.*integer*- An instance of
`<integer>`

.

**Values:**-
*boolean*An instance of`<boolean>`

. **Description:**- Returns true if the
*index*th bit in*integer*is a one-bit; otherwise it returns false.Negative

*integers*are treated as if they were in two's-complement notation.

`ash`

[Function]Performs an arithmetic shift on its first argument.

**Signature:**-
`ash`

Þ*integer1 count**integer2* **Arguments:**-
*integer1*An instance of`<integer>.`

*count*- An instance of
`<integer>.`

**Values:**-
*integer2*An instance of`<integer>`

. **Description:**- 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 zero-bits 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`

[Function]Returns the least common multiple of two integers.

**Signature:**-
`lcm`

Þ*integer1 integer2**integer* **Arguments:**-
*integer1*An instance of`<integer>`

.*integer2*- An instance of
`<integer>`

.

**Values:**-
*integer*An instance of`<integer>`

. **Description:**- Returns the least common multiple of
*integer1*and*integer2.*

`gcd`

[Function]Returns the greatest common divisor of two integers.

**Signature:**-
`gcd`

Þ*integer1 integer2**integer* **Arguments:**-
*integer1*An instance of`<integer>`

.*integer2*- An instance of
`<integer>`

.

**Values:**-
*integer*An instance of`<integer>`

. **Description:**- Returns the greatest common divisor of integer1 and integer2.

Dylan Reference Manual - 17 OCT 1995 [Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker