[Date Index] [Thread Index] [Author Index]
Re: Speeding up a list construction
> Another issue I > found is that with your example code the last item in the list a will > not be accumulated. Is that intended or one of those index errors which > I think are the strongest argument to use something like FoldList > instead of Loops. To really get the same result as your code above you > would need: That omission is intentional. The sum of all entries is kept as a separate variable outside the list asum. Thanks to all who brought my attention to FoldList. I wasnt aware of that function, but it does exist in 4.1. The speedup is about 5:1 on my computer.