Is there any efficient way to convert an unary number to a binary number?

后端 未结 0 1999
花落未央
花落未央 2021-02-15 08:42

Let those datatypes represent unary and binary natural numbers, respectively:

data UNat = Succ UNat | Zero
data BNat = One BNat | Zero BNat | End

u0 = Zero
u1 =         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题