1 Jan 2003 03:26
Re: Question About lists
Andrew J Bromage <ajb <at> spamcop.net>
2003-01-01 02:26:40 GMT
2003-01-01 02:26:40 GMT
G'day all. On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote: > One suggestion, though is that you're working too hard; there's really > no reason to define a locally defined function. The much simpler: > > long [] = 0 > long (x:xs) = 1 + long xs > > will do quite nicely. It has quite different performance characteristics, though. In particular, this uses O(n) stack space whereas the accumulator one uses O(1) stack space. Cheers, Andrew Bromage
RSS Feed