- 2021-01-28: Opposite problem:
You have: [(a, Set b)]
you want: [(a, b)]
e.g.: [("hi", fromList [1,2,3]), ("bye", fromList [4,6,7]) ->
[("hi",1),("hi",2),("hi",3),("bye",4),("bye",6),("bye",7)]
Interestingly, Set is not a Monad. wut. How do you get around that problem? - D Oisín Kidney @oisdk (>>= traverse toList)
- mine: concatMap (sequence . second Set.toList)
- 2021-01-28:
We have [(Set a, b)]
we want [(a, b)]
where each element of Set a is paired with b, e.g.:
[(fromList [1,2,3], 'a'), (fromList [4,5,6], 'b')]
becomes
[(1,'a'),(2,'a'),(3,'a'),(4,'b'),(5,'b'),(6,'b')] - Steve "wash your hands" Trout @strout:
concatMap (uncurry (liftA2 (,)) . bimap toList pure) - insatiable mask wearer @tim_1729
[(a,b) | (s,b) <- xs, a <- (toList s)] - Today, 2021/01/21, is:
- Can be written with only 3 digits, What other dates can be so written? Also:
- a day where the month and day are NOT amalgamation the year. But which dates are amalgamations?
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.
Thursday, January 21, 2021
January 2021 1HaskellADay 1Liners
Wednesday, January 20, 2021
January 2021 1HaskellADay Problems and Solutions
- 2021-01-29: Ambitious! Let's upload some indexed wineries with geo-locations to the graph-store for today's #haskell problem! For today's #haskell solution we added geo-locations and wikidata QNames for some wineries, with shout-outs to @oisdk and @tim_1729, incorporating their #1Liner answers into the solution.
- 2021-01-27: We continue updating our wine-graph with wikidata. Today we update countries in the graph with wikidata QName values. Today's #haskell solution corrects the names of the countries and adds their wikidata QNames, or, put another way: O? Canada?!? NANI???
- 2021-01-26: For today's #haskell problem we compare neo4j graph data to wikidata for wineries now, and what is the "No Country"? And how do I get citizenship there?
- 2021-01-25: Okay, looking at countries aliased between wikidata and a neo4j graph for today's #haskell problem. Today's #haskell solution loads then uses a graph to resolve aliased country names.
- 2021-01-22: Today's #haskell problem: we inject countries of wineries extracted from @wikidata into the mix to ... simplify (?) things? ... wait? There're countries mismatched, too? How ... surprising. 🙄 Today's #haskell solution shows us that wine is "No Country" for old men. ... wait ... wut?
- 2021-01-21: Today's #haskell problem is to compare wineries from @wikidata to those in a @neo4j graph. Also. Did you know that there's a winery in Oregon named "Sweet Cheeks"? Now you do. You're welcome. Today's #haskell solution shows that 125 wineries match, more than 400 don't. Lots of aliasing work ahead of us.
- 2021-01-20: Today's #haskell problem asks you to parse wineries and their geo-locations from a JSON file. Simple problem; simple solution. Also: wine a bit. It helps.
Subscribe to:
Posts (Atom)