
Larry Evans wrote:
On 01/16/2008 01:39 AM, dan marsden wrote:
The operation is certainly not a fold, so I think it would be misleading to associate the example with fold like terminology.
Agreed. A fold operates with a binary op on a sequence of values where the result type of op is same type as operands. The reason I was thinking fold might be applicable is that the example just chose the leaves in the tree of a certain type and added them. Well, add is certainly a valid fold op; so, the difference was some filtering (to the given type) and then flattening the tree to conform to the structure needed by fold. However, now I can see how a different name than fold is needed.
In Fusion, fold() operates on heterogeneous lists and does type unification using statically polymorphic function objects. Ditto for Proto's fold transform. So fold() isn't a bad name, IMHO. -- Eric Niebler Boost Consulting www.boost-consulting.com