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: book question (Lalitha Prasad K)
2. first number is a list (Roelof Wobben)
3. Re: first number is a list (Mats Rauhala)
4. Re: first number is a list (David Virebayre)
5. Re: first number is a list (Thomas Davie)
6. Re: A first try (David Place)
7. Re: first number is a list (Roelof Wobben)
8. Re: A first try (David Place)
9. Re: first number is a list (Mats Rauhala)
----------------------------------------------------------------------
Message: 1
Date: Mon, 27 Jun 2011 15:29:54 +0530
From: Lalitha Prasad K <[email protected]>
Subject: Re: [Haskell-beginners] book question
To: Roelof Wobben <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
For exercises you can look at 99 Haskell problems at the following link
http://www.haskell.org/haskellwiki/99_Haskell_exercises
Solutions are also available, but you should first try with out looking at
the solutions
Lalitha Prasad
On Mon, Jun 27, 2011 at 1:55 PM, Roelof Wobben <[email protected]> wrote:
> Hello,
>
> What's a good book for a absolute beginner in Haskell programming with a
> lot of exercises so I can see if I understand it.
>
> Roelof
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110627/05cd4d15/attachment-0001.htm>
------------------------------
Message: 2
Date: Mon, 27 Jun 2011 11:27:27 +0000
From: Roelof Wobben <[email protected]>
Subject: [Haskell-beginners] first number is a list
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hello, I have to find the first number is a list. So first I tried : let
mylast = last [1,2,3,4]mylast This one works but you have to give 2 commands.
So i was thinking about using list compreshion. So I did : [x | x <- [1,2,3,4]
, last ] But then I see these error : Could not match expected type "Bool"
with actual type [a0] -> a0 in the expression last in stdn of a list
compreshion last in the expression : [x | x <- [1,2,3,4] , last ] What is my
thinking error ? Roelof
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110627/836943d8/attachment-0001.htm>
------------------------------
Message: 3
Date: Mon, 27 Jun 2011 14:50:14 +0300
From: Mats Rauhala <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
I'm sorry, I'm not entirely sure what you're trying to do. Are you
trying to find the first number _in_ a list? That could be done with for
example pattern matching:
head (x:_) = x
head _ = error "Empty list"
The guards in list comprehension requires booleans, you gave it a
function that takes a list and returns an item of the same time.
last :: [a] -> a
--
Mats Rauhala
MasseR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110627/865d3ba3/attachment-0001.pgp>
------------------------------
Message: 4
Date: Mon, 27 Jun 2011 13:48:55 +0200
From: David Virebayre <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: Roelof Wobben <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
2011/6/27 Roelof Wobben <[email protected]>:
> Hello,
>
> I have to find the first number is a list.
>
> So first I tried :
>
> let mylast = last [1,2,3,4]
> mylast
I'm confused :
You say have to find the first number of a list but this gives you the last.
> [x | x <- [1,2,3,4] , last ]
> But then I see these error :
> Could not match expected type "Bool" with actual type [a0] -> a0
It's quite clear: The compiler expects a function that'll return a
Bool value, but you gave it one that takes a list and returns an
element from the list.
Additional terms in the list comprehention are meant to be filters on
elements of the list, not functions that work on the list.
David.
------------------------------
Message: 5
Date: Mon, 27 Jun 2011 12:51:15 +0100
From: Thomas Davie <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: David Virebayre <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On 27 Jun 2011, at 12:48, David Virebayre wrote:
>> But then I see these error :
>> Could not match expected type "Bool" with actual type [a0] -> a0
>
> It's quite clear: The compiler expects a function that'll return a
> Bool value, but you gave it one that takes a list and returns an
> element from the list.
Actually it's saying it expects a bool value, no function at all.
Bob
------------------------------
Message: 6
Date: Mon, 27 Jun 2011 07:54:40 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] A first try
To: Manfred Lotz <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Jun 27, 2011, at 5:15 AM, Manfred Lotz wrote:
> deepseq really ensures parseXmlDoc gets the full file as a string.
>
> It is unclear to me how this could be done without deepseq.
When I started to be truly comfortable programming in Haskell, I found the
constant desire to use deepseq just went away.
____________________
David Place
Owner, Panpipes Ho! LLC
http://panpipesho.com
[email protected]
------------------------------
Message: 7
Date: Mon, 27 Jun 2011 11:55:37 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Oke,
I'm not sure I understand you right. Let's say I have this list [1,2,3,4]How
must I use head now ? Roelof Date: Mon, 27 Jun 2011 14:50:14 +0300
From: [email protected]
To: [email protected]
Subject: Re: [Haskell-beginners] first number is a list
I'm sorry, I'm not entirely sure what you're trying to do. Are you
trying to find the first number _in_ a list? That could be done with for
example pattern matching:
head (x:_) = x
head _ = error "Empty list"
The guards in list comprehension requires booleans, you gave it a
function that takes a list and returns an item of the same time.
last :: [a] -> a
--
Mats Rauhala
MasseR
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110627/87511d51/attachment-0001.htm>
------------------------------
Message: 8
Date: Mon, 27 Jun 2011 07:58:03 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] A first try
To: Heinrich Apfelmus <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
____________________
David Place
Owner, Panpipes Ho! LLC
http://panpipesho.com
[email protected]
On Jun 27, 2011, at 3:50 AM, Heinrich Apfelmus wrote:
> Good point, but this actually shows that withFile should be even lazier. In
> particular:
>
> * The file should not be opened until the string is demanded.
> * The file should be closed as soon as the string has been demanded in full.
Suppose the file is only partially demanded as in the case I quoted earlier.
print10 =
do
contents <- withFile "/usr/share/dict/words" ReadMode (\h ->
hGetContents h)
print $ take 10 contents
The file would never be closed.
------------------------------
Message: 9
Date: Mon, 27 Jun 2011 15:03:00 +0300
From: Mats Rauhala <[email protected]>
Subject: Re: [Haskell-beginners] first number is a list
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
On 11:55 Mon 27 Jun , Roelof Wobben wrote:
>
> Oke,
> I'm not sure I understand you right. Let's say I have this list [1,2,3,4]How
> must I use head now ? Roelof Date: Mon, 27 Jun 2011 14:50:14 +0300
head [1,2,3,4] -- Returns 1
--
Mats Rauhala
MasseR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110627/85cedea4/attachment.pgp>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 36, Issue 70
*****************************************