Integer type basic object model metaclass.
class Integer \ from BOM
downto() | Repeats a function or a sequence until the lower limit is reached. |
ptr() | Returns the value itself. |
times() | repeats a sequence a given number of times. |
upto() | Repeats a function or a sequence until the upper limit is reached. |
__add from BOM | Overrides binary addition operand. |
__call from BOM | Overrides call operator "self()". |
__dec from BOM | Overrides decrement unary prefix operand. |
__decpost from BOM | Overrides decrement unary postfix operand. |
__div from BOM | Overrides binary division operand. |
__getIndex from BOM | Overrides array access operator [] |
__inc from BOM | Overrides increment unary prefix operand. |
__incpost from BOM | Overrides increment unary postifx operand. |
__mod from BOM | Overrides modulo operand. |
__mul from BOM | Overrides binary multiplication operand. |
__pow from BOM | Overrides power operand. |
__setIndex from BOM | Overrides array write operator [] |
__sub from BOM | Overrides binary subtraction operand. |
baseClass from BOM | Returns the class item from which an object has been instantiated. |
bound from BOM | Determines if an item is bound or not. |
className from BOM | Returns the name of the class an instance is instantiated from. |
clone from BOM | Performs a deep copy of the item. |
compare from BOM | Performs a lexicographical comparison. |
derivedFrom from BOM | Checks if this item has a given parent. |
describe from BOM | Returns the deep contents of an item on a string representation. |
isCallable from BOM | Determines if an item is callable. |
len from BOM | Retrieves the length of a collection |
metaclass from BOM | Returns the metaclass associated with this item. |
ptr from BOM | Returns a raw memory pointer out of this data (as an integer). |
serialize from BOM | Serialize the item on a stream for persistent storage. |
toString from BOM | Coverts the object to string. |
typeId from BOM | Returns an integer indicating the type of this item. |
Repeats a function or a sequence until the lower limit is reached.
Integer.downto( llimit, sequence )
llimit | The lower limit of the loop. |
sequence | The sequence or function to be repeated. |
Returns: | The last index processed. |
This method repeats a loop from this integer down to the limit value included. If the limit is greater than this integer, the function returns immediately.
If the sequence is a function, then it is called iteratively with the current index value as last parameter. If it is a sequence, it is functionally evaluated and the &1 parametric binding is set to the index.
5.downto( 2, printl ) 3.downto(0, .[printl "Value number " &1])
In both cases, returning an oob(0) will cause the loop to terminate, while returning an oob(1) from any evaluation in the sequence makes the rest of the evaluation to be skipped and the loop to be restarted.
Returns the value itself.
Integer.ptr( )
Returns: | The value in this integer. |
Falcon integers can be used to store memory locations, as the are granted to be wide at least as the widest pointer on the target platform. For this reason, they can be used to transport raw pointers coming from external libraries.
This function override ensures that .ptr() applied to an integer returns the original integer value (and doesn't get mangled as with other ptr overrides).
repeats a sequence a given number of times.
Integer.times( sequence )
sequence | Function or sequence to be repeated. |
Returns: | Last index processed. |
This method works exactly as the times function when the first parameter is a number.
Repeats a function or a sequence until the upper limit is reached.
Integer.upto( llimit, sequence )
llimit | The upper limit of the loop. |
sequence | The sequence or function to be repeated. |
Returns: | The last index processed. |
This method repeats a loop from this integer down to the limit value included. If the limit is less than this integer, the function returns immediately.
If the sequence is a function, then it is called iteratively with the current index value as last parameter. If it is a sequence, it is functionally evaluated and the &1 parametric binding is set to the index.
2.upto( 5, printl ) 2.downto(5, .[printl "Value number " &1])
In both cases, returning an oob(0) will cause the loop to terminate, while returning an oob(1) from any evaluation in the sequence makes the rest of the evaluation to be skipped and the loop to be restarted.