Parcourir la source

Implement the return function

DricomDragon il y a 5 ans
Parent
commit
562ecb93fb
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  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