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

后端 未结 0 1088
小鲜肉
小鲜肉 2021-02-15 08:31

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 =         


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