瀏覽代碼

Implement an 'add' function for Nat

DricomDragon 5 年之前
父節點
當前提交
517810289f
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      peano.hs

+ 4 - 0
peano.hs

@@ -6,3 +6,7 @@ intValOf thisNat = case thisNat of
 
 natValOf thisInt = if thisInt == 0 then Zero else Succ (natValOf (thisInt - 1))
 
+addition aNat tinyNat = case tinyNat of
+	Zero -> aNat
+	Succ tinierNat -> Succ (addition aNat tinierNat)
+