- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
aggregate methods for traversables, what is it good for?
Thu, 2011-08-18, 19:25
In the source for TraversableOnce.scala, aggregate is defined as:
def aggregate[B](z: B)(seqop: (B, A) => B, combop: (B, B) => B): B = foldLeft(z)(seqop)
I am not sure this provides anything of value that foldLeft doesn't already provide, considering that combop isn't even used.
Am I seeing things straight? Are there other implementations in other Traversables that I need to look at?
def aggregate[B](z: B)(seqop: (B, A) => B, combop: (B, B) => B): B = foldLeft(z)(seqop)
I am not sure this provides anything of value that foldLeft doesn't already provide, considering that combop isn't even used.
Am I seeing things straight? Are there other implementations in other Traversables that I need to look at?
Thu, 2011-08-18, 20:57
#2
Re: aggregate methods for traversables, what is it good for?
Excellent that's where I need to look. Thanks Rex.
aggregate is parallelizable, though as you can see, the default implementation just uses foldLeft. (The parallel collections override this behavior.)
--Rex
On Thu, Aug 18, 2011 at 2:25 PM, Daniel Hinojosa <dh.evolutionnext@gmail.com> wrote: