object Nat
Contains implementation traits for Nat and typeconstructor aliases that make usage more pleasant.
1. Additive commutativity: +[A, B] =:= +[B, A]
2. Additive associativity: +[A, +[B, C]] =:= +[+[A, B], C]
3. Additive identity: +[A, _0] =:= A =:= +[_0, A]
4. Multiplicative commutativity: *[A, B] =:= *[B, A]
5. Multiplicative associativity: *[A, *[B, C]] =:= *[*[A, B], C]
6. Multiplicative identity: *[A, _1] =:= A =:= *[_1, A]
7. Distributivity: *[A, +[B, C]] =:= +[*[A, B], *[A, C]]
8. Zero exponent: ^[A, _0] =:= _1
9. One exponent: ^[_1, A] =:= _1
10. Exponent Identity: ^[A, _1] =:= A
11. Total Order
Author:
Harshad Deo
- Since
0.1
- Grouped
- Alphabetic
- By Inheritance
- Nat
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
*[A <: Nat, B <: Nat] = Nat.*.A.FoldR[_0, Nat, SumFold[B]]
Alias for multiplying two numbers
Alias for multiplying two numbers
Author:
Harshad Deo
- Since
0.1
-
type
+[A <: Nat, B <: Nat] = Nat.+.A.FoldR[B, Nat, IncFold]
Alias for adding two numbers
Alias for adding two numbers
Author:
Harshad Deo
- Since
0.1
-
type
<[A <: Nat, B <: Nat] = Nat.Compare.Match[True.type, False.type, False.type, Bool]
Alias for checking if the first number is less than the second
Alias for checking if the first number is less than the second
Author:
Harshad Deo
- Since
0.1
-
type
<=[A <: Nat, B <: Nat] = Nat.Compare.Match[True.type, True.type, False.type, Bool]
Alias for checking if the first number is less than or equal to the second
Alias for checking if the first number is less than or equal to the second
Author:
Harshad Deo
- Since
0.1
-
type
===[A <: Nat, B <: Nat] = Nat.Compare.Match[False.type, True.type, False.type, Bool]
Alias for checking if the two numbers are equal
Alias for checking if the two numbers are equal
Author:
Harshad Deo
- Since
0.1
-
type
>[A <: Nat, B <: Nat] = Nat.Compare.Match[False.type, False.type, True.type, Bool]
Alias for checking if the first number is greater than the second
Alias for checking if the first number is greater than the second
Author:
Harshad Deo
- Since
0.1
-
type
>=[A <: Nat, B <: Nat] = Nat.Compare.Match[False.type, True.type, True.type, Bool]
Alias for checking if the first number is greater than or equal to the second
Alias for checking if the first number is greater than or equal to the second
Author:
Harshad Deo
- Since
0.1
-
type
Compare[A <: Nat, B <: Nat] = Nat.Compare.A.Compare[B]
Alias for getting the result of comparing two numbers
Alias for getting the result of comparing two numbers
Author:
Harshad Deo
- Since
0.1
-
trait
ExpFold
[By <: Nat] extends Fold[Nat, Nat]
Fold to compute the exponent
Fold to compute the exponent
Author:
Harshad Deo
- Since
0.1
-
type
Fact[A <: Nat] = Nat.Fact.A.FoldL[_1, Nat, ProdFold]
Alias for computing the factorial of the number
Alias for computing the factorial of the number
Author:
Harshad Deo
- Since
0.1
-
trait
Fold
[-Elem, Value] extends AnyRef
Typeclass for typelevel and valuelevel fold
Typeclass for typelevel and valuelevel fold
Author:
Harshad Deo
- Since
0.1
-
trait
IncFold
extends Fold[Any, Nat]
Fold to compute the increment of a number
Fold to compute the increment of a number
Author:
Harshad Deo
- Since
0.1
-
type
IsO[A <: Nat] = Nat.IsO.A.Match[ConstFalse, True, Bool]
Alias for checking if the number is zero
Alias for checking if the number is zero
Author:
Harshad Deo
- Since
0.1
-
sealed
class
NatRep
[N <: Nat] extends AnyRef
Builds a value level representation of the Nat
Builds a value level representation of the Nat
Author:
Harshad Deo
- N
Natural number for which the value level representation is being built
- Since
0.1
-
trait
ProdFold
extends Fold[Nat, Nat]
Fold to compute the product
Fold to compute the product
Author:
Harshad Deo
- Since
0.1
-
type
Sq[A <: Nat] = Nat.Sq.A.FoldR[_0, Nat, SumFold[FoldR[_1, Nat, ExpFold[A]]]]
Alias for computing the square of the number
Alias for computing the square of the number
Author:
Harshad Deo
- Since
0.1
-
trait
Succ
[N <: Nat] extends Nat
Represents a successor in the peano encoding of natural numbers
Represents a successor in the peano encoding of natural numbers
Author:
Harshad Deo
- N
Peano-type to which this is a successor
- Since
0.1
-
trait
SumFold
[By <: Nat] extends Fold[Nat, Nat]
Fold to compute the sum
Fold to compute the sum
Author:
Harshad Deo
- Since
0.1
-
type
^[A <: Nat, B <: Nat] = Nat.^.B.FoldR[_1, Nat, ExpFold[A]]
Alias for computing the exponent of the number
Alias for computing the exponent of the number
Author:
Harshad Deo
- Since
0.1
-
type
_0 = Nat0.type
Peano 0
Peano 0
Author:
Harshad Deo
- Since
0.1
-
type
_1 = Succ[_0]
Peano 1
Peano 1
Author:
Harshad Deo
- Since
0.1
-
type
_2 = Succ[_1]
Peano 2
Peano 2
Author:
Harshad Deo
- Since
0.1
-
type
_3 = Succ[_2]
Peano 3
Peano 3
Author:
Harshad Deo
- Since
0.1
-
type
_4 = Succ[_3]
Peano 4
Peano 4
Author:
Harshad Deo
- Since
0.1
-
type
_5 = Succ[_4]
Peano 5
Peano 5
Author:
Harshad Deo
- Since
0.1
-
type
_6 = Succ[_5]
Peano 6
Peano 6
Author:
Harshad Deo
- Since
0.1
-
type
_7 = Succ[_6]
Peano 7
Peano 7
Author:
Harshad Deo
- Since
0.1
-
type
_8 = Succ[_7]
Peano 8
Peano 8
Author:
Harshad Deo
- Since
0.1
-
type
_9 = Succ[_8]
Peano 9
Peano 9
Author:
Harshad Deo
- Since
0.1
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toInt[N <: Nat](implicit ev: NatRep[N]): Int
Builds a value level representation of a Nat
Builds a value level representation of a Nat
Author:
Harshad Deo
- N
Nat for which the value level representation is to be built
- Since
0.1
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
Nat0
extends Nat
Represents zero in peano encoding of natural numbers
Represents zero in peano encoding of natural numbers
Author:
Harshad Deo
- Since
0.1
-
object
NatRep
Provides implicit definitions to build a value level representation of a Nat
Provides implicit definitions to build a value level representation of a Nat
Author:
Harshad Deo
- Since
0.1