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

Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Nat
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

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

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

  3. type <[A <: Nat, B <: Nat] = Nat.Compare.Match[True, False, False, 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

  4. type <=[A <: Nat, B <: Nat] = Nat.Compare.Match[True, True, False, 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

  5. type ===[A <: Nat, B <: Nat] = Nat.Compare.Match[False, True, False, 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

  6. type >[A <: Nat, B <: Nat] = Nat.Compare.Match[False, False, True, 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

  7. type >=[A <: Nat, B <: Nat] = Nat.Compare.Match[False, True, True, 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

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

  9. trait ExpFold[By <: Nat] extends Fold[Nat, Nat]

    Fold to compute the exponent

    Fold to compute the exponent

    Author:

    Harshad Deo

    Since

    0.1

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

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

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

  13. final class 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

  14. final class NatRep[N <: Nat] extends AnyVal

    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

  15. trait ProdFold extends Fold[Nat, Nat]

    Fold to compute the product

    Fold to compute the product

    Author:

    Harshad Deo

    Since

    0.1

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

  17. final class 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

  18. trait SumFold[By <: Nat] extends Fold[Nat, Nat]

    Fold to compute the sum

    Fold to compute the sum

    Author:

    Harshad Deo

    Since

    0.1

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

  20. type _0 = Nat0

    Peano 0

    Peano 0

    Author:

    Harshad Deo

    Since

    0.1

  21. type _1 = Succ[_0]

    Peano 1

    Peano 1

    Author:

    Harshad Deo

    Since

    0.1

  22. type _2 = Succ[_1]

    Peano 2

    Peano 2

    Author:

    Harshad Deo

    Since

    0.1

  23. type _3 = Succ[_2]

    Peano 3

    Peano 3

    Author:

    Harshad Deo

    Since

    0.1

  24. type _4 = Succ[_3]

    Peano 4

    Peano 4

    Author:

    Harshad Deo

    Since

    0.1

  25. type _5 = Succ[_4]

    Peano 5

    Peano 5

    Author:

    Harshad Deo

    Since

    0.1

  26. type _6 = Succ[_5]

    Peano 6

    Peano 6

    Author:

    Harshad Deo

    Since

    0.1

  27. type _7 = Succ[_6]

    Peano 7

    Peano 7

    Author:

    Harshad Deo

    Since

    0.1

  28. type _8 = Succ[_7]

    Peano 8

    Peano 8

    Author:

    Harshad Deo

    Since

    0.1

  29. type _9 = Succ[_8]

    Peano 9

    Peano 9

    Author:

    Harshad Deo

    Since

    0.1

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. 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

  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. 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

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Implementation

Number aliases

Operations

Ungrouped