Ludwig.Int

Module Members

add

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

div

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

eq

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

gt

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

gte

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

lt

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

lte

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

mod

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

mul

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

negate

(Function)

Negate an Ludwig.Int.

Note that this is currently the only way to specify a negative literal.

Example:

negative1: negate(1)           # => -1
positive1: negate(negative1)   # => 1

Type Signature

 fun (Int) -> Int
Argument: x
Type: Int
Returns:
Type: Int

neq

(Function)

Type Signature

 fun (Int, Int) -> Bool
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Bool

pow

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

range

(Function)

Generate a list of Ludwig.Ints, separated by step value and optionally inclusive of to.

Example:

xsa: Int.range{to: 5}                     # => [0,1,2,3,4,5]
xsb: Int.range{to: 5, step: 2}            # => [0,2,4]
xsc: Int.range{from: 1, to: 5}            # => [1,2,3,4,5]
xsd: Int.range{to: 5, inclusive: False}   # => [0,1,2,3,4]
xs: String.join('', [ Int.toString(x) for x in Int.range{to: 5} ])  # => "012345"

Type Signature

 fun { from: Optional<Int>,
       to: Int,
       inclusive: Optional<Bool>,
       step: Optional<Int> } -> List<Int>
Argument: from

The beginning of the range.

Type: Optional<Int>

Argument: to

The end of the range.

Type: Int

Argument: inclusive

Whether to include the to value. If addition of step exceeds to, this is overridden to False.

Type: Optional<Bool>

Argument: step

The difference between each number in the list.

Type: Optional<Int>

Returns:

The list of integers, as specified.

Type: List<Int>

sub

(Function)

Type Signature

 fun (Int, Int) -> Int
Argument: x
Type: Int
Argument: y
Type: Int
Returns:
Type: Int

toString

(Function)

Convert an Ludwig.Int to a Ludwig.String.

Example:

x1: toString(42)        # => "42"
x2: toString(negate(1)) # => "-1"

Type Signature

 fun (Int) -> String
Argument: n

The Ludwig.String to convert.

Type: Int

Returns:

n as a Ludwig.String.

Type: String


(Operator)

operator % infixl 7:
  mod

Modulo operator for Ludwig.Ints.


(Operator)

operator * infixl 7:
  mul

Multiplication operator for Ludwig.Ints.


(Operator)

operator + infixl 6:
  add

Addition operator for Ludwig.Ints.


(Operator)

operator - infixl 6:
  sub

Subtraction operator for Ludwig.Ints.


(Operator)

operator / infixl 7:
  div

Division operator for Ludwig.Ints.

<

(Operator)

operator < infixl 4:
  lt

Less than operator for Ludwig.Ints.

<=

(Operator)

operator <= infixl 4:
  lte

Less than or equal operator for Ludwig.Ints.

>

(Operator)

operator > infixl 4:
  gt

Greater than operator for Ludwig.Ints.

>=

(Operator)

operator >= infixl 4:
  gte

Greater than or equal operator for Ludwig.Ints.


(Operator)

operator ^ infixr 8:
  pow

Exponent operator for Ludwig.Ints.