Next Previous Up Top Contents Index

6 The Machine Words Module

6.2 Useful functions from the Dylan module

This section describes additional methods defined in the Dylan module that pertain to <machine-word>. Note that this section only describes extensions to the Dylan library; for complete descriptions, you should also refer to the Dylan Reference Manual.

Note that the Common Dylan library also has these extensions because it uses the Dylan library.

odd?

Sealed Method

odd? (m :: machine-word) => _ :: boolean

even?

Sealed Method

even? (m :: machine-word) => _ :: boolean

zero?

Sealed Method

zero? (m :: machine-word) => _ :: boolean

Cannot be used as the name of a result. It is not a valid Dylan name.
positive?

Sealed Method

positive? (m :: machine-word) => _ :: boolean

negative?

Sealed Method

negative? (m :: machine-word) => _ :: boolean

These functions return a result based on interpreting m as a signed integer value.

=

Sealed Method

= (m1 :: machine-word, m2 :: machine-word) => _ :: boolean

=

Sealed Method

= (i1 :: abstract-integer, m2 :: machine-word) => _ :: boolean

=

Sealed Method

= (m1 :: machine-word, i2 :: abstract-integer) => _ :: boolean

The comparison is performed with the machine-word arguments interpreted as signed integer values.

<

Sealed Method

< (m1 :: machine-word, m2 :: machine-word) => _ :: boolean

<

Sealed Method

< (i1 :: abstract-integer, m2 :: machine-word) => _ :: boolean

<

Sealed Method

< (m1 :: machine-word, i2 :: abstract-integer) => _ :: boolean

The comparison is performed with the machine-word arguments interpreted as signed integer values.

as

Sealed Method

as(t == <integer>, m :: machine-word) => _ :: integer

The result is an integer with the same value as m when interpreted as a signed integer value. An error is signaled if the value of m cannot be represented as an instance of integer.
as

Sealed Method

as(t == <abstract-integer>, m :: machine-word) => _ :: abstract-integer

The result is an abstract-integer with the same value as m when interpreted as a signed integer value.
(The uses for an instance of abstract-integer that is not also an instance of integer are rather limited without the Generic-Arithmetic library.)
as

Sealed Method

as(t == <machine-word>, i :: abstract-integer) => _ :: machine-word

If the value of i is outside the machine word range, then the result consists of the low $machine-word-size bits of the twos-complement representation of i. If any of the discarded bits differ from the sign of i, then an error is signaled.
limited

Sealed Method

limited(t == <machine-word>,
  #key signed? :: boolean,
       min :: machine-word, max :: machine-word) 
=> _ :: type

If the signed? argument is true (the default) then the min and max arguments are interpreted as signed values. When signed? is false, the min and max arguments are interpreted as unsigned values. The default value for each of min and max depends on the value of signed?. The defaults are taken from the corresponding minimum and maximum machine word values (see $maximum-signed-machine-word and related constants below).

For convenience, the values of min and/or max may also be instances of <abstract-integer>, in which case they are coerced to instances of <machine-word> as if by using as.


Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index