Integer type basic object model metaclass.
Class Integer from \ BOM( )
Methods | |
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. |
Methods inherited from class BOM | |
__add | Overrides binary addition operand. |
__call | Overrides call operator "self()". |
__dec | Overrides decrement unary prefix operand. |
__decpost | Overrides decrement unary postfix operand. |
__div | Overrides binary division operand. |
__getIndex | Overrides array access operator [] |
__inc | Overrides increment unary prefix operand. |
__incpost | Overrides increment unary postifx operand. |
__mod | Overrides modulo operand. |
__mul | Overrides binary multiplication operand. |
__pow | Overrides power operand. |
__setIndex | Overrides array write operator [] |
__sub | Overrides binary subtraction operand. |
baseClass | Returns the class item from which an object has been instantiated. |
bound | Determines if an item is bound or not. |
className | Returns the name of the class an instance is instantiated from. |
clone | Performs a deep copy of the item. |
compare | Performs a lexicographical comparison. |
derivedFrom | Checks if this item has a given parent. |
describe | Returns the deep contents of an item on a string representation. |
isCallable | Determines if an item is callable. |
len | Retrieves the length of a collection |
metaclass | Returns the metaclass associated with this item. |
ptr | Returns a raw memory pointer out of this data (as an integer). |
serialize | Serialize the item on a stream for persistent storage. |
toString | Coverts the object to string. |
typeId | 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. |
Return | 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()
Return | 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. |
Return | Last index processed. |
This method works exactly as the times function when the first parameter is a number.
See also: times.
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. |
Return | 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.