Bosatsu/Num/Nat

Index

Types

Nat

This is the traditional encoding of natural numbers it is useful when you are iterating on all values

type Nat

Constructors

  • Succ(prev: Nat)
  • Zero

Values

add

def add(n1: Nat, n2: Nat) -> Nat

cmp_Nat

def cmp_Nat(a: Nat, b: Nat) -> Comparison

div2

def div2(n: Nat) -> Nat

divmod

def divmod(numerator: Nat, divisor: Nat) -> (Nat, Nat)

exp

def exp(base: Nat, power: Nat) -> Nat

is_even

def is_even(n: Nat) -> Bool

mul2

This is an O(n) operation

def mul2(n: Nat) -> Nat

mult

def mult(n1: Nat, n2: Nat) -> Nat

sub_Nat

def sub_Nat(n1: Nat, n2: Nat) -> Nat

to_Int

def to_Int(n: Nat) -> Int

to_Nat

def to_Nat(i: Int) -> Nat
The source code for this page can be found here.