1. 5

It is interesting that they are exploring such a fundamental feature in such a way, wonder how that will go.


  2. 4

    Ah, not general catamorphisms just a convenient syntax for left and right folds over a few choice operators.

    1. 1

      I think that they are eventually going to be dealing with function identifiers and lambdas being allowed in place of the operators, given that in C++14 they have introduced polymorphic lambdas. There seems also to not be a syntactic collision with either using a function identifier or a lambda for doing the fold. Unless they get “scared” of complicating the language by getting into more practical functional programming territory with such an obvious addition to this.

      1. 2

        The challenge is that this syntax does not provide for the “base” of the fold anywhere except by convention over the set of approved operators.

        And still, I wouldn’t call this a catamorphism until we’re talking about general catamorphisms over recursive data types. Right and left folds are ultimately nothing more than particular catamorphisms: ones specialized to the structure of a linked list!

        1. 2

          Perfectly agree! Whatever they come up with, they will inevitably have to deal with exactly what you are discussing, at least they started focusing on the meaning of the word and hopefully will not end up abusing it like the “functor” term as used in C++!

          1. 2

            Agreed as well : )

    2. 3

      Based on the obscene design limitations, this is probably more useful http://en.cppreference.com/w/cpp/algorithm/accumulate

      1. 1

        If they ever think of expanding it without those design limitations, perhaps a woefully designed language for such things as C++ will become slightly better. I am amused that they started doing these things at a language feature level. Until then they are only introducing a shortcut to std::accumulate, in my eyes.