[Haskell-beginners] program not running lazily
Rein Henrichs
rein.henrichs at gmail.com
Thu Jan 21 18:42:43 UTC 2016
But not that doing so will cause the program to have an exponential runtime
as each new ys must be repeatedly traversed to append a [y].. The
alternative is to *unfold* your list by recursing on the right hand side of
the (:) to add new elements.
On Thu, Jan 21, 2016 at 5:43 AM Doug McIlroy <doug at cs.dartmouth.edu> wrote:
> Each time you find another good 9-mer, you add it to
> the head of the list. This means that the ultimate
> list will be in reverse order of discovery: the first element
> to be printed is the last one to be found. To get
> output in the order it was discovered, build the
> output by ys++[y] rather than y:ys.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160121/da105dea/attachment.html>
More information about the Beginners
mailing list