Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

integer

integer is a module that provides functions for operating on integers.

Functions


abs: integer -> integer

Returns the absolute value of the passed integer.

Example

# <span class='hljs-keyword'>module</span> demo =
    <span class='hljs-keyword'>let</span> five = <span class='hljs-title class_'>integer</span><span class='hljs-punctuation'>::</span>abs <span class='hljs-operator'>-</span><span class='hljs-variable constant_'>5</span>
    <span class='hljs-keyword'>let</span> alsofive = <span class='hljs-title class_'>integer</span><span class='hljs-punctuation'>::</span><span class='hljs-title function_'>abs</span> <span class='hljs-variable constant_'>5</span>
# <span class='hljs-keyword'>end</span>

pow: integer -> integer -> integer

Returns the first passed integer to the power of the second passed integer.

Example

# <span class='hljs-keyword'>module</span> demo =
    <span class='hljs-keyword'>let</span> four = <span class='hljs-title class_'>integer</span><span class='hljs-punctuation'>::</span><span class='hljs-title function_'>pow</span> <span class='hljs-variable constant_'>2</span> <span class='hljs-variable constant_'>2</span>
    <span class='hljs-keyword'>let</span> eight = <span class='hljs-title class_'>integer</span><span class='hljs-punctuation'>::</span><span class='hljs-title function_'>pow</span> <span class='hljs-variable constant_'>2</span> <span class='hljs-variable constant_'>3</span>
# <span class='hljs-keyword'>end</span>