- 2021-04-28: We build a recommendation-system from spotty data for today's #haskell problem. runRecs rekt the run of the ... rektrun? Bah: today's #haskell solution, with implication to the rescue!
- 2021-04-26: Today's #haskell problem, on m̸͈̣̈́̉̉̊̈́y̴̢͌̇̕ ̷̡̗͎̰̠͚̓̈́͠B̷̙͋͊̈̕͘Į̷̻̱͔̼̙͖͚̥̄͝R̴͉̖̻̬̗͕͋̽̉̚͝T̵͈̮͙͚̤̘̦̮͐̓́̔̂͑̋̐̐̄H̶̬̳͔͔̳̀̉̇̋͒D̵̢̡̧̦̖̝͖͕͕̤̊Ȃ̷̧̩̼͔̱͙̟̺̕Y̴̡̢̮̘͛̄̽͛̆̃͌ we solve what every Gubmint agency faces every hour of the day: what does this 'TLA' stand for? Today's #haskell solution: Don't mind me. I'm just TLA'ing over here.
- 2021-04-23: WHO WOULD WIN THIS FIGHT: Ragnarr Loðbrók or Miyamoto Musashi? Today's #haskell problem gives a bean-counter's approach, ... LITERALLY! Today's #haskell solutions shows that the winner of the Viking-Samurai deth-match is: ViewPatterns! ... obviously. 😎
- 2021-04-22: In today's #haskell exercise we try to find the opposite of Kung Fu Fighting, and we fail (because there is no opposite of awesome ... besides fail. GEDDIT?) So we try to find the dual of Kung Fu Fighting. Easy, no? "Your WuShu Praying Mantis-style is strong, but can it match my Tiger Claw-style?" Narrator: "We find out the thrilling conclusion in today's #haskell solution!"
- 2021-04-14: In today's #haskell exercise we learn it requires 'Expert Timing' to be 'Kung Fu Fighting.' So, we have fighting; we have noodles. We have everything we need for today's #haskell solution.
- 2021-04-12: For today's #haskell problem we are lifting a "plain" method into the monadic domain ... yes, I'm influenced by @BartoszMilewski writing. Why do you ask? Today's #haskell solution: Function: lifted.
- 2021-04-09: We get all officious, ... sry: 'OFFICIAL' ... with today's #haskell problem. Today's #haskell solution shows us that you haven't met real evil until your TPS-report cover letter is ... Lorem Ipsum.
- 2021-04-08, Thursday: In today's #haskell problem we optionally parse a string into some value of some type. Some how. Today's #haskell solution shows us the sum of the numbers in the string was 42 (... no, it wasn't).
- 2021-04-07, Wednesday: decode vs. eitherDecode from Data.Aeson is today's #haskell exercise. In today's #haskell solution we find that it's nice when eitherDecode tells you why it failed to parse JSON.
- 2021-04-05, Monday: Today's #haskell exercise is to make a vector that is Foldable and Traversable. Today's #haskell solution gives us Vectors as Foldable and Traversable. YUS!
- 2021-04-01, Holy Thursday: In today's #haskell exercise we learn the WHOPR beat the Big Mac. We also learn how to make a safe call to an HTTPS endpoint, but that's not important as the WHOPR beating the Big Mac. "Would you like to play a game?" Today's #haskell solution says: "Yes, (safely, please)."
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, April 1, 2021
April 2021 1HaskellADay Problems and Solutions
Tuesday, March 23, 2021
March 2021 1HaskellADay 1Liners
- 2021-03-23:
You have
[a]and(a -> IO b).You want
IO [(a, b)]That is, you want to pair your inputs to their outputs for further processing in the IO-domain.
- Chris Martin @chris__martin:
\as f -> traverse @ [] @ IO (\a -> f a >>= \b ->return (a, b)) as - cλementd Children crossing @clementd:
traverse (sequenceA . id &&& f)(actually,
tranverse (sequence . (id &&& f)))Or
p traverse (traverse f . dup)
- Chris Martin @chris__martin:
- 2021-03-23: You have
[([a], [b])]You want
([a], [b])so:
[([1,2], ["hi"]), ([3,4], ["bye"])]becomes
([1,2,3,4],["hi","bye"])- karakfa @karakfa:
conc xs = (concatMap fst xs, concatMap snd xs)
- karakfa @karakfa:
Monday, March 1, 2021
March 2021 1HaskellADay Problems and Solutions
- 2021-03-31, Wednesday: Let's go on 50 last dates for today's #haskell problem. Today's #haskell solution shows us the fifty last dates were the fifty best dates.
- 2021-03-30, Tuesday: Directorizin' ... WITH STYLE! ... is today's #haskell problem. Today's #haskell solution: BEHOLD THE MIGHTY POWER OF THE <*>!
- 2021-03-29, Monday: Today's #haskell problem tackles plurality and connectives to list the contents of our Fruits Basket. Today's #haskell solution gives us fruits, in the basket, properly-speaking, thanks to George Boole.
- 2021-03-25, Thursday: Today's #haskell problem has me FORTHing AT THE MOUTH! ... AGAIN! ... no, ... wait ...
- 2021-03-23, Tuesday: Let's go FORTH! and conquer! for today's #haskell problem. Today's #haskell solution gives us a little FORTHer to go FORTH and FORTH! ... and also demonstrates Gauss' sum formula ... IN FORTH! ... which is nice.
- 2021-03-22, Monday: Fixing-up and validating a JSON-as-string (and don't get me started) is today's #haskell problem. Today's #haskell solution uses Data.Aeson to transform some JSON, ... typefully.
- 2021-03-19: pi. Not pie. Not tau. pi... you know, or: close enough, is served as today's #haskell problem (via @AnecdotesMaths). PI! for today's #haskell solution. And a pie recipe from Sumeria, if you're in a baking-mood.
- 2021-03-18: Today's #haskell problem is to update lookup tables with new values. Today's #haskell solution gets the indices for foo, bar, quux, and ... Joe??? Okay.
- 2021-03-16: Today's #haskell problem uses natural language processing to consolidate words in the cloud. et, voilà: Grace Hopper wikipedia entry word-cloud, trimmed and stemmed, for today's #haskell solution.
- 2021-03-15: Today's #haskell problem explores Grace Hopper's wikipedia entry as a word-cloud generated by d3js.org for #WomensHistoryMonth Today's #haskell solution removed some obvious things (punctuation and citations) to simplify Grace Hopper's word-cloud. #WomenHistoryMonth
- 2021-03-11: It's not every Tom, Dick, and Harry that can do today's #haskell exercise... In today's #haskell solution you want an id? YOU GOT AN ID! 😤
- 2021-03-09: Let's query a directory and do something with each file in that directory for today's #haskell problem. Today's #haskell solution? THAT WAS EASY! ... so! What are we doing tomorrow? 😃
- 2021-03-05: Today we're shell-scripting ... WITH HASKELL! 😤 Today's #haskell solution says: "Well, hello there, good lookin'!"
- 2021-03-04: Today's #haskell problem: you have a time-series of values, not necessary gapless, get the latest value; then, get 'yesterday's' value. Today's #haskell solution gives us some useful functions to navigate a time-series of values.
- 2021-03-03: Today's #haskell problem asks: "Where in the world are these wineries?" Then answers that question. Ooh! Wineries! Wineries all over the globe! is in today's #haskell solution.
- 2021-03-02: For today's #haskell problem, let's add approved matched data to wineries in the graph-store. The #haskell solution! ... with a pic!
- 2021-03-01: Today's #haskell problem approves matched wineries for (eventual) storage. We approve wiki-to-graph winery metaphone matches for today's #haskell solution.
Monday, February 1, 2021
February 2021 1HaskellADay Problems and Solutions
- 2021-02-26: Today's #haskell problem we will be matching the metaphone'd-wineries from wikidata and from the graph-store. Today's #haskell solution gave us 16 good matches from 30 candidates.
- 2021-02-25: For today's #haskell problem we load the wineries' metaphones to the graph-store. Today's #haskell solution: MWA-HAHA! I HAVE METAPHONES FOR WINERIES!
- 2021-02-24: "What's today's date?" is today's #haskell problem. For today's #haskell solution, I think I found the successor to "Hello, world!"
- 2021-02-23: Today's #haskell exercise involves calling an external process with a winery and reading the double-metaphone encoded result. Today's #haskell solution tied our wiki- and graph-winery data to an external name-categorizing app.
- 2021-02-22: We now have a graph-store of wines, wineries, and wine-reviews, and wikidata, too! One Direction (no, not the boy-band) we can go is to merge the wikidata to our knowledge base. Project! Today's #haskell solution: (graph) wineries and (wikidata) wineries.
- 2021-02-19: Okay, we have our ~120k wine-reviews uploaded to a graph-store, great! Did we do it correctly? Hm. Today's Haskell problem. Today's #haskell solution asks: "Duplicate wine reviews? What duplicate wine reviews? Blink, blink."
- 2021-02-18: Adding prices and scores to the unicoded wine-reviews in the graph-store is today's #haskell problem. Boom! Today's #haskell solution gives us prices, scores, and wine-reviews now in the graph-store.
- 2021-02-17: Today's #haskell problem is yesterday's Haskell problem: saving out a CSV-file, but this time, we're going to save the unicode points: 'good'! Today's #haskell solution: Yay! Properly encoded unicode!
- 2021-02-16: Today's #haskell problem is to correct unicoded wine-reviews, then to save them in a CSV file for eventual upload to a graph-store. For today's #haskell solution, we came, we saw, we saved CSV, ... unicode points not quite properly encoded.
- 2021-02-15: Today's #haskell problem looks for errors in the wine-reviews JSON file which makes it invalid. Today's #haskell solution fixes JSON with a custom-build scanner.
- 2021-02-12: Today's #haskell problem: unicode, properly encoded for Text. Imagine that. Today's #haskell solution SOLVES the unicoding-problem ... except that it doesn't. :/
- 2021-02-08: In today's #haskell problem we tackle wading through wine-reviews to upload to the graph-store. Today's #haskell solution: we are able to upload some (1600+) wine-reviews so far.
- 2021-02-05: Now that we've identified duplicates in our wine graph-store, today's #haskell problem is to eliminate duplicates. In today's #haskell solution we removed duplicate wine-labels and verified no duplicate wineries, as well.
- 2021-02-04: For today's #haskell problem with look at data duplication in the graph-store (particularly: duplicated wine-labels). Today's #haskell solution shows which wines are duplicates (and triplicates, and ... megalons?)
- 2021-02-03: Today's #haskell problem looks at adding wine reviews (with some optional data) to the graph-store. Today's #haskell solution we uploaded a (very (very)) small subset of wine-reviews, prices and ratings to the graph-store.
- 2021-02-02: Enhancing graph-store data. From the @kaggle wine-taster data-set, let's extract and add the twitter handles of those who have them. Today's #haskell solution adds the wine-reviewers' twitter handles to the graph-store.
- 2021-02-01: Today's #haskell problem: counting 'dupe?' rows in a CSV file over HTTPS. Today's #haskell solution ponders: what is that 'dupe?' column for, anyway?
Thursday, January 21, 2021
January 2021 1HaskellADay 1Liners
- 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?
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.
Tuesday, December 1, 2020
December 2020 1HaskellADay Problems and Solutions
- 2020-12-22: Monads are burritos, but today's #haskell problem brings together the whole enchilada! In today's #haskell solution we find that whole enchilada is a hot tamale! ... and also map all the air bases of an alliance.
- 2020-12-21: Collecting the airbases for all the countries of an alliance from the graph-store is today's #haskell exercise. Today's #haskell solution shows how to work with the `withArray` Aeson function.
- 2020-12-18: For today's #haskell problem, we extract an alliance, its member countries, and their capitals from the graph-store to display these data on a global-viewer, such as google Earth. For today's #haskell solution, with #KML and @neo4j, we see that this is an alliance that nearly spans the globe!
- 2020-12-16: Extracting an alliance and its member countries from a graph store is today's #haskell problem. In today's #haskell solution we find that, hm, marshalling aggregated data is more than a bit of work!
- 2020-12-15: "What is the capital of Singapore?" for today's #haskell problem. Today's #haskell solution shows that the capital of Singapore is ... well: SINGAPORE! YAY!
- 2020-12-11: For today's #haskell problem we will be adding lats and longs to country capitals in our graph-store. Capitals now have lats/longs in the graph-store.
- 2020-12-10: Today's #haskell problem is to relink capitals from aliases to source countries. Today's #haskell solution clarified the problem, then provided a data-correction-solution.
- 2020-12-09: Reassociating alliances from alias nodes to their source country nodes. Today's #haskell solution: and we update aliased-alliances-... oops! Unicode. Joy.
- 2020-12-07: For today's #haskell problem, we filter out unicode points in both countries and their aliases, ... but we also ask: is filtering the right way to go, or are unicode points being properly represented in JSON by Data.Aeson? Today's #haskell solution provides aliases to country names (... even as we add some manually ... *cough* #PleaseIgnoreTheManBehindTheCurtain)
- 2020-12-03: Today's #haskell problem: adding alias names to a country ... should be simple? BUT UNICODE! :( Today's #haskell solution: UNICODE FIXED FOR ALIASES! WOOT! ... but what about for the source countries? IM CRIE! 😭
- 2020-12-02: Yesterday, we triaged data for correction. Today #haskell problem is data correction, part I: adding `new` countries we missed before. Today's #haskell solution: o, Guinea-Bissau, be ye no longer an orphan, but be home, now, in Africa!
- 2020-12-01: Data correction. Half the problem of data-correction is to realize that you must do a data-correction. The other half of half the problem is to gather the data that needs to be corrected, along with the context of the correction: today's #haskell problem. Today's #haskell solution shows that the concept of triage is so helpful in setting up to solve data-correction problems.
Subscribe to:
Posts (Atom)
































