소스 검색

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)
+