mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
Set 5a Ex 11: minor fixes in exercise text
This commit is contained in:
+2
-2
@@ -239,14 +239,14 @@ fromList :: [(k,v)] -> KeyVals k v
|
||||
fromList = todo
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Exercise 11: The data type Nat is the so called Peano
|
||||
-- Ex 11: The data type Nat is the so called Peano
|
||||
-- representation for natural numbers. Define functions fromNat and
|
||||
-- toNat that convert natural numbers to Ints and vice versa.
|
||||
--
|
||||
-- Examples:
|
||||
-- fromNat (PlusOne (PlusOne (PlusOne Zero))) ==> 3
|
||||
-- toNat 3 ==> Just (PlusOne (PlusOne (PlusOne Zero)))
|
||||
-- toNat (-3) ==> Nothing
|
||||
-- fromNat (PlusOne (PlusOne (PlusOne Zero))) ==> 3
|
||||
--
|
||||
|
||||
data Nat = Zero | PlusOne Nat
|
||||
|
||||
Reference in New Issue
Block a user