Explorar o código

Implement the return function

DricomDragon %!s(int64=5) %!d(string=hai) anos
pai
achega
562ecb93fb
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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