The integer class defines all the methods needed to handle integer computations. The class integer is a subclass of the class scalar . Internally, an integer is defined as a C/C++ type long long, ie always 64 bits, as well on an ILP32 CPU than on a LP64 CPU. Division by 0 or overflow throws an error which can be intercepted by a catch form. The integer value itself is stored in the car part of a wwlisp cell, beginning at the lowest address, but being 64 bits, cannot be seen completely by the carvalue function on a 32 bits machine. |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the product of all the arguments |
Example | (* 2 3.0) => 6 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the sum of all the arguments |
Example | (+ 1 2 3.0) => 6 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the result of the successive subtraction of the second argument from the first, the third from the result, the fourth from the result, and so on |
Example | (- 5 1 1 1.0) => 2 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the result of the successive division of the first argument by the second, the result by the third, the result by the fourth, and so on; in case of overflow or division by 0, an error is thrown |
Example | (/ 1000 3 2) => 166 |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | adds 1 to the argument and returns the new value |
Example | (1+ 3) => 4 |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | subtracts 1 from the argument and returns the new value |
Example | (1- 3) => 2 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or
integers |
Return Value | t or nil |
Description | returns t if the series of arguments is strictly
increasing |
Example | (< 1 2 3.0) => t |
Function Type | subr |
Arguments | an integer, an unsignedinteger, float or integer |
Return Value | t or nil |
Description | returns t if the values of the arguments are numerically equal |
Example | (= 1 1.0) => t |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or
integers |
Return Value | t or nil |
Description | returns t if the series of arguments is strictly
decreasing |
Example | (> 3 2 1.0) => t |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | returns the absolute value of the argument |
Example | (abs -1) => 1 |
Function Type | subr |
Arguments | an integer object |
Return Value | a string |
Description | returns a string containing the base64 translation of the integer; the length is fixed to 11 characters for the 64 bits integers; endianity is unchanged |
Example | (base64 0) => "AAAAAAAAAAA" |
Function Type | subr |
Arguments | an integer |
Return Value | a binary block |
Description | returns a binary block containing the integer; the length of the block is 4 bytes on a 32 bits CPU and 8 bytes on a 64 bits CPU |
Example | (binary 1) |
Function Type | subr |
Arguments | none |
Return Value | an integer |
Description | returns an integer initialized at zero; never use directly integer-constructor , but do it always through make-instance or implicit creation |
Example | (make-instance integer) => 0 |
Function Type | subr |
Arguments | an integer |
Return Value | t or nil |
Description | returns t if the argument is even, nil if odd |
Example | (evenp 2) => t |
Function Type | subr |
Arguments | an integer |
Return Value | a float |
Description | returns a float with the value of the argument |
Example | (float 3) => 3.000000 |
Function Type | subr |
Arguments | an integer |
Return Value | a string |
Description | returns a string containing the formatted value of the object passed as argument; is the default formatter of the class integer |
Example | (format 33) => "33" |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the greatest common dividing value of the arguments |
Example | (gcd 49 1001) => 7 |
Function Type | subr |
Arguments | an integer object |
Return Value | a string |
Description | returns a string containing the hexadecimal translation of the integer; the length is variable with the leading zeroes suppressed; endianity is MSB: most significant bits are on the left; |
Example | (hexadecimal 240) => "f0" |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | returns the argument; needed when converting an argument which can be float or integer |
Example | (integer x) |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the least common multiple of the arguments |
Example | (lcm 2 3 5) => 30 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the highest, most positive argument |
Example | (max 1 2 3) => 3 |
Function Type | subr |
Arguments | an integer, an unlimited number of floats or integers |
Return Value | an integer |
Description | returns the lowest, most negative argument |
Example | (min 1 2 -3) => -3 |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | returns the opposite of the argument |
Example | (minus 1) => -1 |
Function Type | subr |
Arguments | an integer |
Return Value | t or nil |
Description | returns t if the argument is negative |
Example | (minusp 0) => nil |
Function Type | subr |
Arguments | an integer |
Return Value | t or nil |
Description | returns t if the argument is odd |
Example | (oddp 1) => t |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | returns a random integer comprised between 0 and the argument |
Example | (random 10) |
Function Type | subr |
Arguments | an integer, an integer or a float |
Return Value | an integer |
Description | returns the remainder of the integer division of the first argument by the second, ie the modulo |
Example | (remainder 10 3) => 1 |
Function Type | subr |
Arguments | an integer |
Return Value | an integer |
Description | returns the integer given as argument; the function allows to do rounding on a scalar without to know in advance if it is a float (where the method is part of the class) or an integer where it was not yet defined |
Example | (round 33) => 33 |
Function Type | subr |
Arguments | an integer |
Return Value | a string |
Description | returns a string which contains the formatted integer value |
Example | (string -1000) => "-1000" |
Function Type | subr |
Arguments | an integer |
Return Value | an unsignedinteger |
Description | returns an unsignedinteger containing the value of the argument; the function is much like a C cast, and does not truncate negative values, but rather returns a bit pattern |
Example | (unsignedinteger -1000) => 0xfffffc18 |
Function Type | subr |
Arguments | an integer |
Return Value | t or nil |
Description | returns t if the argument is zero |
Example | (zerop 0) => t |