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) (Ertugrul Soeylemez)
2. Re: making function problem (chapter 6 of Programming in
Haskell) (Roelof Wobben)
3. Re: making function problem (chapter 6 of Programming in
Haskell) (Ertugrul Soeylemez)
4. Re: making function problem (chapter 6 of Programming in
Haskell) (Roelof Wobben)
5. Re: Conciseness question (Manfred Lotz)
6. Re: having trouble with helloworld style program (David Place)
7. Re: having trouble with helloworld style program
(Ertugrul Soeylemez)
8. Re: having trouble with helloworld style program (Antoine Latter)
9. Re: making function problem (chapter 6 of Programming in
Haskell) (Roelof Wobben)
10. Re: making function problem (chapter 6 of Programming in
Haskell) (David Beacham)
----------------------------------------------------------------------
Message: 1
Date: Mon, 8 Aug 2011 17:17:18 +0200
From: Ertugrul Soeylemez <[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=US-ASCII
Roelof Wobben <[email protected]> wrote:
> Maybe this :
>
> x ^ 0 = 1
> x ^ y = x * (y-1)
No, that's wrong. Don't try guessing things, because that will bring
you nowhere with Haskell.
But at least you are getting closer to the idea of solving things
through algebraic rules.
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 2
Date: Mon, 8 Aug 2011 15:24:13 +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"
----------------------------------------
> To: [email protected]
> From: [email protected]
> Date: Mon, 8 Aug 2011 17:17:18 +0200
> Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
> Programming in Haskell)
>
> Roelof Wobben <[email protected]> wrote:
>
> > Maybe this :
> >
> > x ^ 0 = 1
> > x ^ y = x * (y-1)
>
> No, that's wrong. Don't try guessing things, because that will bring
> you nowhere with Haskell.
>
> But at least you are getting closer to the idea of solving things
> through algebraic rules.
>
>
> Greets,
> Ertugrul
>
>
> --
> nightmare = unsafePerformIO (getWrongWife >>= sex)
> http://ertes.de/
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
Im not guessing.
Im trying to understand what you mean by exponation rules.
As far as I can imagaging it cannot be done the same way as you described the
sum problem.
Roelof
------------------------------
Message: 3
Date: Mon, 8 Aug 2011 17:28:08 +0200
From: Ertugrul Soeylemez <[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=US-ASCII
Roelof Wobben <[email protected]> wrote:
> Im not guessing.
>
> Im trying to understand what you mean by exponation rules.
>
> As far as I can imagaging it cannot be done the same way as you
> described the sum problem.
Try with multiplication first. If you can do multiplication, then
exponentiation should be clear.
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 4
Date: Mon, 8 Aug 2011 15:35:55 +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"
----------------------------------------
> To: [email protected]
> From: [email protected]
> Date: Mon, 8 Aug 2011 17:28:08 +0200
> Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
> Programming in Haskell)
>
> Roelof Wobben <[email protected]> wrote:
>
> > Im not guessing.
> >
> > Im trying to understand what you mean by exponation rules.
> >
> > As far as I can imagaging it cannot be done the same way as you
> > described the sum problem.
>
> Try with multiplication first. If you can do multiplication, then
> exponentiation should be clear.
>
>
> Greets,
> Ertugrul
>
>
> --
> nightmare = unsafePerformIO (getWrongWife >>= sex)
> http://ertes.de/
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
Oke,
Just to be sure.
I only have to use suc and pred ?
I think you want something like this :
x + 0 = x
x + y = succ x + pred y
Roelof
------------------------------
Message: 5
Date: Mon, 8 Aug 2011 17:48:34 +0200
From: Manfred Lotz <[email protected]>
Subject: Re: [Haskell-beginners] Conciseness question
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
On Mon, 8 Aug 2011 07:31:32 -0700
KC <[email protected]> wrote:
> Sorry, I haven't read all the replies so I don't know if you have
> completely described the problem you're trying to solve; however, it
> might be better for people in future to say they want O(1) for
> insertions, O(lg n) for searching, etc.
>
> If they don't want to completely describe what their problem is.
>
>
>
Well, it might be that this time the description of my problem was not
fully satisfying (at least in the beginning) for others being able to
answer me.
However, I have to say the help I got was great (as is usually the
case in Haskell news groups). Thanks to all who replied. I feel my
question being answered fully.
--
Thanks again,
Manfred
------------------------------
Message: 6
Date: Mon, 8 Aug 2011 12:08:29 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] having trouble with helloworld style
program
To: Ertugrul Soeylemez <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
>> main =do
>> x<-getLine
>> y<-return x
>> print $ stringToInt y
>
> This is exactly equivalent to the other methods, but has the additional
> 'return', which is a no-op. Please do not suggest such a style.
>
Really? Without the return it will not work. So, it isn't a noop.
Stylistically, I like it better than the 'let' in 'do' notation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110808/d87520f7/attachment-0001.htm>
------------------------------
Message: 7
Date: Mon, 8 Aug 2011 18:40:41 +0200
From: Ertugrul Soeylemez <[email protected]>
Subject: Re: [Haskell-beginners] having trouble with helloworld style
program
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
David Place <[email protected]> wrote:
> >> main =do
> >> x<-getLine
> >> y<-return x
> >> print $ stringToInt y
> >
> > This is exactly equivalent to the other methods, but has the
> > additional 'return', which is a no-op. Please do not suggest such a
> > style.
>
> Really? Without the return it will not work. So, it isn't a noop.
> Stylistically, I like it better than the 'let' in 'do' notation.
It will not work, because you have additional identifiers. The code
y <- return x
really just states the same as:
let y = x
and this is a requirement of the monad laws:
c >=> return = c
return >=> c = c
Abusing 'return' is mostly an artifact from former imperative
programmers, who think that 'return' in Haskell is a control construct.
It's not; it's just a function.
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 8
Date: Mon, 8 Aug 2011 11:44:32 -0500
From: Antoine Latter <[email protected]>
Subject: Re: [Haskell-beginners] having trouble with helloworld style
program
To: David Place <[email protected]>
Cc: "[email protected]" <[email protected]>, Ertugrul
Soeylemez <[email protected]>
Message-ID:
<CAKjSnQGJOh46ncCXYzOzzqk=sf86by-lurhjbrjyy7_zx-o...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On Mon, Aug 8, 2011 at 11:08 AM, David Place <[email protected]> wrote:
>
> main =do
>
> ??x<-getLine
>
> ??y<-return x
>
> ??print $ stringToInt y
>
> This is exactly equivalent to the other methods, but has the additional
> 'return', which is a no-op. ?Please do not suggest such a style.
>
>
> Really? ?Without the return it will not work. So, it isn't a noop.
> Stylistically, I like it better than the 'let' in 'do' notation.
I think he means that the entire line is a no-op.
The line:
> y <- return x
is equivalent to:
> let y = x
and since re-naming a value doesn't perform any computation, you may
as well delete the line and use 'x' everywhere you would have used
'y':
> main =do
> x<-getLine
> print $ stringToInt x
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
------------------------------
Message: 9
Date: Mon, 8 Aug 2011 18:12:47 +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"
----------------------------------------
> From: [email protected]
> To: [email protected]
> Date: Mon, 8 Aug 2011 15:35:55 +0000
> Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
> Programming in Haskell)
>
>
>
>
> ----------------------------------------
> > To: [email protected]
> > From: [email protected]
> > Date: Mon, 8 Aug 2011 17:28:08 +0200
> > Subject: Re: [Haskell-beginners] making function problem (chapter 6 of
> > Programming in Haskell)
> >
> > Roelof Wobben <[email protected]> wrote:
> >
> > > Im not guessing.
> > >
> > > Im trying to understand what you mean by exponation rules.
> > >
> > > As far as I can imagaging it cannot be done the same way as you
> > > described the sum problem.
> >
> > Try with multiplication first. If you can do multiplication, then
> > exponentiation should be clear.
> >
> >
> > Greets,
> > Ertugrul
> >
> >
> > --
> > nightmare = unsafePerformIO (getWrongWife >>= sex)
> > http://ertes.de/
> >
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
>
>
>
>
>
>
> Oke,
>
>
>
> Just to be sure.
>
> I only have to use suc and pred ?
>
>
>
> I think you want something like this :
>
>
>
> x + 0 = x
> x + y = succ x + pred y
>
>
>
> Roelof
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
oke,
Maybe you are looking something like this :
x * 0 = 0
0 * y = 0
x * y = z
Roelof
------------------------------
Message: 10
Date: Mon, 08 Aug 2011 19:18:55 +0100
From: David Beacham <[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; format=flowed
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
End of Beginners Digest, Vol 38, Issue 19
*****************************************