[Haskell-beginners] Evaluate function

Derek McLoughlin derek.mcloughlin at gmail.com
Mon May 26 13:03:37 UTC 2014


Thanks. Reading back, this is actually explained on page 14 - sorry for
that.
On 26 May 2014 11:22, "Daniel Fischer" <daniel.is.fischer at googlemail.com>
wrote:

> 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.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140526/cd850497/attachment.html>


More information about the Beginners mailing list