Class Integer

Integer type basic object model metaclass.

class Integer \ from BOM

Summary

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.

Inherited methods

add__ from BOM Overrides binary addition operand.
baseClass from BOM Returns the class item from which an object has been instantiated.
call__ from BOM Overrides call operator "self()".
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.
dec__ from BOM Overrides decrement unary prefix operand.
decpost__ from BOM Overrides decrement unary postfix operand.
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.
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.
isCallable from BOM Determines if an item is callable.
len from BOM Retreives the lenght of a collection
metaclass from BOM Returns the metaclass associated with this item.
mod__ from BOM Overrides modulo operand.
mul__ from BOM Overrides binary multiplication operand.
pow__ from BOM Overrides power operand.
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.
setIndex__ from BOM Overrides array write operator []
sub__ from BOM Overrides binary subtraction operand.
toString from BOM Coverts the object to string.
typeId from BOM Returns an integer indicating the type of this item.

Methods

downto()

Repeats a function or a sequence until the lower limit is reached.

Integer.downto( llimit, sequence )

llimitThe lower limit of the loop.
sequenceThe 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.

ptr()

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

times()

repeats a sequence a given number of times.

Integer.times( sequence )

sequenceFunction or sequence to be repeated.
Returns:Last index processed.

This method works exactly as the times function when the first parameter is a number.

upto()

Repeats a function or a sequence until the upper limit is reached.

Integer.upto( llimit, sequence )

llimitThe upper limit of the loop.
sequenceThe 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.


Made with faldoc 2.1.0