Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-adam committed May 15, 2024
1 parent c36d5d9 commit 32b1fa7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pl.writeonly.catculator.core.adt.calculus

import cats.implicits.catsSyntaxEq
import pl.writeonly.catculator.core.adt.calculus.Combinator.CombinatorBT
import pl.writeonly.catculator.core.adt.calculus.Constants._
import spire.math.Natural
Expand All @@ -21,9 +20,9 @@ object InputEncoder {

def cons(a: CombinatorBT, b: CombinatorBT): CombinatorBT = app3(sCom, Constants.app3SI(appK(a)), appK(b))

def church(n: Natural): CombinatorBT = n.toBigInt match {
case n if n === BigInt(0) => falseCom
case n => succChurch(Natural(n - BigInt(1)))
def church(n: Natural): CombinatorBT = n match {
case n if n === Natural.zero => falseCom
case n => succChurch(n - Natural.one)
}

private def succChurch(n: Natural): CombinatorBT = successor(church(n))
Expand Down

0 comments on commit 32b1fa7

Please sign in to comment.