- 2020-10-21: Curry `key` from
secondPassFilter :: Ord a => a -> Set a -> Maybe b
secondPassFilter key = spf key . Set.lookupGE key
Givenspf :: a -> Maybe a -> Maybe b
- 2020-10-21: given:
updater :: b -> Maybe b
andfirstPass :: Ord a => Map a b -> Map a b
firstPass m = foldr (Map.update updater) m (Map.keys m)
#Curry away `m` from the firstPass-function - Social Justice Cleric @noaheasterly
firstPass = foldr (Map.update updater) <*> Map.keys
- 2020-10-20:
all (\c -> any (`isPrefixOf` c) setb) notinb
#Curry away the `c` lambda argument.
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.
Wednesday, October 21, 2020
October 2020 Haskell 1-Liners
Friday, October 9, 2020
October 2020 1HaskellADay Problems and Solutions
- 2020-10-30: Today's #haskell problem is to read and to parse a wikitext file to get a comprehensive list of military alliances. Parsing wikitext of alliances of the world... WITH #haskell!
- 2020-10-28: Today's #haskell problem is to ingest military alliances of the world from http://wikidata.org as JSON. The #haskell solution: (*:)-operator and a higher-order alter-function FTW!
- 2020-10-26: The previous week we've examined wikidata for countries, continents and airbases. For today's #haskell exercise, let's memorialize our findings.* 'memorialize our findings' is a fancy-pants term for 'print statement,' ICYMI. For the #haskell solution, "We are now going to introduce some steps that are a bit more difficult... Ready. Set. And. Begin."
- 2020-10-23: Today's #haskell problem: "Unicode? What, even, is that?" ... sez Haskell, smh. Also, if you know how to get Text not to escape unicode points on output (to, say, a REST endpoint), much obliged if you told me this dark magic. Today's #haskell solution shows airbases (with their associated countries) added to the graph database.
- 2020-10-20: Next evolutionary step. We have Continents and countries as data structures. For today's #haskell problem let's find out how we can (can't?) merge in airbases with countries. Hoo, doggies! "Upload airbases to the graph database!" he said. "It'll be easy!" he said. Today's #haskell solution, if not in book-form, then in book-length!
- 2020-10-16: Map of a -> b or b -> a? ... If you're asking that question, why not Graph? Today's #haskell exercise. A mapping of continents to countries. Surprisingly, wikidata.org does not have this as data amenable to extraction.
- 2020-10-15: From continent->country mapping to country->continent mapping for today's #haskell problem. `sequence` is the secret-sauce for today's #haskell solution.
- 2020-10-14: Today's #haskell problem is to get countries by continent from a ... 'markdown' file? That is not markdown. Deal with it. Countries: meet your Continents.
- 2020-10-13: Okay. #StringsAreWrong. Everybody knows this. Wikidata: "Let's encode LongLats as strings ... IN JSON!" Please let's not. Today's #haskell exercise. The solution that produces airbases with lat/longs. REAL lat/longs, smh.
- 2020-10-12: Today's #haskell problem is airbases of the world from wikidata.org ... with some duplicates. Today's #haskell solution reads in JSON, even ... 'JSON' that encodes 'LongLat's (not lat/longs) as ... strings? Really? Yes, even points-as-strings. Remember: #StringsAreWrong ~ Richard A. O'Keefe, 26 April 1994
- 2020-10-09: Today's #haskell problem is this: Production data: "Let's see if we can make the simple act of parsing a 'JSON file' [that isn't a JSON file] impossible for the ol' el geophf!" Nice try, production data. Nice try.
Subscribe to:
Posts (Atom)