Tuesday, September 1, 2020

September 2020 Haskell 1-liners

  • 2020-09-08: given

    removeInfreqs :: Set String -> Ontology -> Ontology
    removeInfreqs infrequentWords ont = 
       Map.map (\wordcounts -> foldl (flip ri') wordcounts infrequentWords) ont

    where Ontology is a map-of-maps.

    1. remove flip to get the same functional result.
    2. curry away ont from the function removeInfreqs
    3. curry away wordcounts from the map-lambda function.
    4. curry away infrequentWords from the function removeInfreqs

      n.b.: This curry may not be as straightforward as the other curries.

  • 2020-09-01: Given all of the above, and now that you've curried the above lambda to [SPOILER]:

    \key -> const (not (Set.member key stoppers))

    Curry away key from this new lambda.

No comments: