Haskell: why the convention to name a helper function “go”?

后端 未结 3 1000
天涯浪人
天涯浪人 2020-12-04 13:04

I see go a lot when reading Haskell material or source, but I\'ve never been really comfortable about it - (I guess it has the negative connotation of \"goto\"

3条回答
  •  生来不讨喜
    2020-12-04 13:58

    I'd expect this idiom to be applicable not just to linear structures (and hence "loops"), but also to branching (tree-like) structures.

    I wonder how often the go pattern corresponds to accumulation parameters and, more generally, with the continuation-encoding strategites that Mitch Wand explored in the paper Continuation-Based Program Transformation Strategies (one of my all-time favorite papers). In these cases, the go function has a particular meaning, which can then be used to derive efficient code from an elegant specification.

提交回复
热议问题