Browse Source

Implement an 'add' function for Nat

DricomDragon 5 năm trước cách đây
mục cha
commit
517810289f
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  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)
+