
----------------------------------------
To: beginners@haskell.org From: es@ertes.de Date: Mon, 8 Aug 2011 16:36:18 +0200 Subject: Re: [Haskell-beginners] making function problem (chapter 6 of Programming in Haskell)
Roelof Wobben
wrote: I think you mean something like this :
2 ^ 3 = = 2 * 2 ^ 2 = 2 * 2 * 2 ^1 = 2 * 2 * 2 * 2 ^ 0 = 2 * 2 * 2 * 1 = 2 * 2 * 2 = 4 * 2 = 8
Yes, but that's not a rule system. Try to come up with a rule system to express exponentiation. You need two rules for the algorithm you want to implement.
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
Maybe this : x ^ 0 = 1 x ^ y = x * (y-1) Roelof