by ehsanu1 · 15y ago · 0 comments
(define (sum x) (fold + 0 x))
Writing it this way is more idiomatic Scheme, and isn't really cumbersome.I was asking more about code in the wild that uses accumulate instead of the naive recursive formulation. That's typically what we mean by idiomatic.
I see foldl often in haskell, but rarely in scheme. I'm not disagreeing that it's a great idea, just that this is how it 'would have been written'. Personally I find the naive recursive formulation plenty clear.