Skip to content

Fold pattern was confusing to me #54

Open
@ehuss

Description

@ehuss

The Fold pattern seemed confusing to me. The term "fold" in functional programming has a pretty clear definition (which includes a combining function), and it's not immediately clear from the example how it applies.

As used in the Rust compiler, it looks like their "Folders" are a general purpose map, reduce, or unfold operation on a tree, with the default operation of the base trait working as identity functions. Perhaps this is similar to Haskell's Traversable type class?

Anyways, I think it could be a little clearer. Perhaps in type theory or compiler circles using "Fold" in this context makes sense, but to me it seemed odd.

BTW, if you are curious, the term "fold" in a functional language sense was probably started by David Turner in the SASL language in the late 70's/early 80's.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-patternArea: Content about PatternsC-enhancementCategory: Enhancements to content

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions