<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 11 Apr 2013, at 10:47, Benjamin Edwards &lt;<a href="mailto:edwards.benj@gmail.com">edwards.benj@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p dir="ltr">(:) is O(1), (++) is O(n). Try and implement (++) and it should be easy to see why.</p></blockquote>(++) is O(n) in the length of it's first argument, which here is a constant 1, so it's O(1).</div><div><br></div><div>That said, the book's implementation is *margionally* better. &nbsp;The implementation using (++) creates the list [x], and then destroys it again, and creates another one when it does the append. &nbsp;The version using (:) does not do this.</div><div><br></div><div>Thanks</div><div><br></div><div>Tom Davie</div><div><br></div><br></body></html>