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.  Evaluate function (Derek McLoughlin)
   2. Re:  Evaluate function (Daniel Fischer)


----------------------------------------------------------------------

Message: 1
Date: Mon, 26 May 2014 10:00:33 +0100
From: Derek McLoughlin <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Evaluate function
Message-ID:
        <caaw9fmkadkqde29bvn5jnlkjm8rfqj_hpsmajcbwvvd-vjb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Reading "Parallel and Concurrent Programming in Haskell", at the bottom of
page 27 the author wants to force the evaluation of a list of Strings:

evaluate ( length puzzles )

Why not just

evaluate puzzles

?

https://github.com/simonmar/parconc-examples/blob/master/sudoku4.hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140526/cf0ff9a3/attachment-0001.html>

------------------------------

Message: 2
Date: Mon, 26 May 2014 12:21:54 +0200
From: Daniel Fischer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Evaluate function
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On Monday 26 May 2014, 10:00:33, Derek McLoughlin wrote:
> Reading "Parallel and Concurrent Programming in Haskell", at the bottom of
> page 27 the author wants to force the evaluation of a list of Strings:
> 
> evaluate ( length puzzles )
> 
> Why not just
> 
> evaluate puzzles
> 
> ?
> 
> https://github.com/simonmar/parconc-examples/blob/master/sudoku4.hs

Because "evaluate" means "evaluate to weak head normal form", that is, to the 
outermost constructor or lambda.

evaluate puzzles

would evaluate the list just so far that it is known whether the list is empty 
or not.

To evaluate something completely, one needs to evaluate a value that depends 
on the complete structure. Presumably, to determine the length of the list, 
one needs to evaluate all paths completely to see whether they lead to a valid 
puzzle, hence the evaluation is forced by demanding the evaluation of the 
length.


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 71, Issue 30
*****************************************

Reply via email to