Kaynağa Gözat

Implement the return function

DricomDragon 5 yıl önce
ebeveyn
işleme
562ecb93fb
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      hpal.hs

+ 6 - 1
hpal.hs

@@ -1,4 +1,9 @@
-r _ = 1
+r n = rconcat n 0
+
+rconcat inv outv  =
+	if inv == 0
+	then outv
+	else rconcat (div inv 10) (outv * 10 + mod inv 10)
 
 ispal n = r n == n