<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 21, 2016 at 5:43 AM Doug McIlroy <<a href="mailto:doug@cs.dartmouth.edu">doug@cs.dartmouth.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Each time you find another good 9-mer, you add it to<br>
the head of the list. This means that the ultimate<br>
list will be in reverse order of discovery: the first element<br>
to be printed is the last one to be found. To get<br>
output in the order it was discovered, build the<br>
output by ys++[y] rather than y:ys.<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>