Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: making function problem (chapter 6 of Programming in
Haskell) (Roelof Wobben)
2. Re: making function problem (chapter 6 of Programming in
Haskell) (KC)
----------------------------------------------------------------------
Message: 1
Date: Mon, 8 Aug 2011 18:58:36 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
Programming in Haskell)
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
----------------------------------------
> Date: Mon, 8 Aug 2011 19:18:55 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
> Programming in Haskell)
>
> On 08/08/11 16:17, Ertugrul Soeylemez wrote:
> >> > Maybe this :
> >> >
> >> > x ^ 0 = 1
> >> > x ^ y = x * (y-1)
> Hi Roelof,
>
> I don't think you're far away - it could just be a typo/lack of care in
> writing it down. Have you tried putting some actual values into these
> rules? - that should help you understand what is wrong with what you've
> written down/get you closer to the correct solution.
>
> For example: (x=2, y=4) 2^4 = 16 != 6 = 2 * 3
>
> David.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
Oke,
what Im trying to say it this :
2 ^ 4
= 2 * 2 ^ 3
= 2 * 2 * 2 ^ 2
= 2 * 2 * 2 * 2 ^ 1
= 2 * 2 * 2 * 2 * 2 ^ 0
So the y is on each number one less on each run.
So maybe it's x ^ y = x * x ^ y
Roelof
------------------------------
Message: 2
Date: Mon, 8 Aug 2011 14:59:39 -0700
From: KC <[email protected]>
Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
Programming in Haskell)
To: [email protected]
Message-ID:
<camlkxykhmfna96v4ol8wvdhghwv++snm6f4lz0epqbok4fp...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hint
positivePower :: Int -> Int -> Int
positivePower x 1 = x
positivePower x y = dododoo positivePower yadayada
--
--
Regards,
KC
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 38, Issue 20
*****************************************