function accumulate(combiner, nullValue, l) { if (l.length == 0) return nullValue; var first = l.shift(); return combiner(first, accumulate(combiner, nullValue, l)); }
sumOfSquares([1,2,3,4,5])
no subject
Date: 2013-05-13 05:09 am (UTC)Using the function
Implement sumOfSquares, which calculates the sum of squares of a list, for example
should evaluate to 55.