On Sun, Nov 13, 2022 at 8:18 AM Marc Nieper-Wißkirchen <
xxxxxx@gmail.com> wrote:
I will think about it; catamorphism is less generic than "implicit
recursion", so it should be clearer.
That does not follow. In natural-language semantics, "hyponym" is less generic than "narrower term", but saying that _raven_ is a hyponym of _bird_ is less clear than saying that _bird_ is a narrower equivalent of _raven_, unless the word _hyponym_ is already familiar to the reader. A possible alternative to _catamorphism_ would be _generalized fold_, since many people have heard of folds but not catamorphisms (and similarly for unfolds and anamorphisms).
That said, in my opinion this is not good Scheme code since record
types have been standardized. Especially in a language with dynamic
typing, it is important to have strong runtime types; using general
lists to model trees, however, is an example of very weak typing.
See my general comment above. If you use let-match and lambda-match
regularly you are, at least in my opinion, probably not writing the
best Scheme code; Scheme has multiple values so where ML would need
records, for Scheme you would use apply and receive (SRFI 8).
Or not, according to the same argument I gave above. Multiple values are sometimes useful, but not always the most perspicuous approach: it would be false, for example, to claim that vectors are somehow "un-Schemey" because vector code could be systematically rewritten using multiple values.