<p dir="ltr">(:) is O(1), (++) is O(n). Try and implement (++) and it should be easy to see why.</p>
<div class="gmail_quote">On 11 Apr 2013 10:44, &quot;Angus Comber&quot; &lt;<a href="mailto:anguscomber@gmail.com">anguscomber@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">LYAH beginner on page 55.<div><br></div><div>What I try to do is see the heading of a section, eg repeat function and then try to come up with my own version before looking at books implementation.</div>
<div><br></div><div>Here is my implementation:</div><div><br></div><div><div>repeat&#39; :: a -&gt; [a]</div><div>repeat&#39; x = [x] ++ repeat&#39; x</div><div><br></div><div>Here is books:</div>
<div><br></div><div><div>repeat&#39; :: a -&gt; [a]</div><div>repeat&#39; x = x:repeat&#39; x<br></div><div><br></div><div>Mine appears to work.  Is mine just as good?  Are there problems with my way?  Is books way more idiomatic Haskell?</div>

<div><br></div><div>I want to learn the best approaches hence my question.</div><div><br></div></div></div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div>