
9 Mar
2010
9 Mar
'10
10:28 p.m.
On Tue, Mar 09, 2010 at 10:35:06PM +0200, Mihai Maruseac wrote:
myLength xs = foldl addOne 0 xs where addOne x n = n + 1
Almost, Tim's original addOne is actually addOne x n = x + 1 The difference is that the given solution uses foldr whereas Tim was using foldl. Either one works in this case since + is commutative. -Brent