2020-09-08: given
removeInfreqs :: Set String -> Ontology -> Ontology removeInfreqs infrequentWords ont = Map.map (\wordcounts -> foldl (flip ri') wordcounts infrequentWords) ont
where
Ontologyis a map-of-maps.- remove
flipto get the same functional result. - curry away
ontfrom the functionremoveInfreqs - curry away
wordcountsfrom the map-lambda function. curry away
infrequentWordsfrom the functionremoveInfreqsn.b.: This curry may not be as straightforward as the other curries.
- remove
2020-09-01: Given all of the above, and now that you've curried the above lambda to [SPOILER]:
Curry away\key -> const (not (Set.member key stoppers))keyfrom this new lambda.
Incorporates strong typing over predicate logic programming, and, conversely, incorporates predicate logic programming into strongly typed functional languages. The style of predicate logic is from Prolog; the strongly typed functional language is Haskell.
Tuesday, September 1, 2020
September 2020 Haskell 1-liners
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment