- 2020-08-31:
#Haskell #BetterWithCurry #1Liner For:>>> :t Map.filterWithKey Map.filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a
we have this filtering function:
\key _val -> not (Set.member key stoppers)_valis unused. Curry it away. - 2020-08-28:
rmFront :: Set Char -> String -> StringrmFront weirds str = dropWhile (flip Set.member weirds) strSimple currying questions: can this function-implementation be simplified with currying? Can it be simplified ... MORE? Answers: yes, and yes. Show your implementation. - 2020-08-26: We have this:
\info -> importBook info >>= return . (info,)There are way too manyinfo-references. What's a better way to write this expression? - Five solutions from @noaheasterly:
- runKleisli (id &&& Kleisli importBook)
- liftA2 (liftA2 (,)) return importBook
- liftA2 (fmap . (,)) id importBook
- traverse importBook . join (,)
- traverse importBook . (id &&& id)
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, August 26, 2020
August 2020 1HaskellADay 1Liners
Monday, August 3, 2020
August 2020 1HaskellADay Problems and Solutions
- 2020-08-31: For today's #haskell problem we learn the nature of the words "the" and "yesterday." Fundamental things. SCROOGE! Yesterday's #haskell solution shows us that "scrooge" was the most-written word in "A Christmas Carol." Fancy that!
- 2020-08-28: Today's #haskell problem: a word-frequency analysis, ... a CLEAN-word-frequency analysis. Today's #haskell solution. Amazing, isn't it, that the word Charles Dickens wrote the most, by far, was 'the'. #writerslife
- 2020-08-27: We're looking at 'weird characters' and 'weird words' for today's #haskell problem. We found words, weird words, and the weird characters in those weird words in today's #haskell solution.
- 2020-08-26: For today's #haskell problem, let's download the top-100 books from project gutenberg! For today's #haskell solution, we have the top-100 gutenberg books, downloaded and ready for analysis!
- 2020-08-25: "Project Gutenberg, here I come!" is my battle-cry for today's #Haskell problem. We have an index to book indices for yesterday's #haskell solution.
- 2020-08-24: Multiplication using cosines is called ... Prosthaphaeresis... and also called: "today's #haskell problem."
- 2020-08-21: Gimme a hint? ... or two? Today's #haskell problem is to find words in dictionaries with the help of supplied hints. "Alien." The word was "alien" for today's #Haskell solution (because it's always the aliens) (I didn't say that.) I, FOR ONE, WELCOME OUR NEW ALIEN OVERLORDS!
- 2020-08-20: Yesterday we did word-lookups from provided dictionaries. Today's #haskell problem is a little analysis (a word histogram) of those word-dictionaries.
"fromList [(1,234371)]" That, there, them's alotta words, yup. Yesterday's #haskell solution. - 2020-08-19: SKRIBBL.io! (A part of) SKRIBBL.io is the #Haskell challenge for today. And the #haskell solution, monad-style!
- 2020-08-10: HEAPS! Luv me sum HEAPS! Today's #haskell problem is to define the Heap collection and its operations.
- 2020-08-03: Today's #haskell problem is to generate random permutation of active team members. So, yeah: random permutes down low on the team members, d'#Haskell
Thursday, July 2, 2020
July 2020 1HaskellADay Problems and Solutions
- 2020-07-31: Well, that's random. Generating random numbers and sequences is today's #Haskell problem. Today's #haskell solution shows that I can (<*>) that monad, first go, without even looking it up or anything. So, yeah, I'm walking pretty tall right now.
- 2020-07-30: Kate and Shoaib are going on vacation. Commander Adama in Star Wars tells us that for today's #haskell problem, we are to "Make it so, Number one." And: there they go! Shoaib and Kate, going on a vacay, havin' fun, and type-safely, at that, because of the #haskell solution 'n stuff.
- 2020-07-29: "How many days until ...?" A date calculator for today's #haskell problem. When I say: "Compute the date," I'm not talking fig trees, here. The solution to today's #Haskell problem.
- 2020-07-28: Today's #haskell problem involves passing arguments to and verifying results from an external application. 'frankenfurters.' That's what we're trying to sum here. 'frankenfurters.' 'Fault Tolerance'? We've got that with today's #haskell solution.
- 2020-07-27: Today's #Haskell exercise makes us realize that ... "All, in all, you're just a ... nother brick in THE WALL. :/" A solution pour vous, s'il vous plaît.
- 2020-07-24: Today's #haskell problem explores the result of processed images from, in this case, Amazon's Rekognition. Today's #haskell solution: BIRDz! ... Cardinals, in fact.
- 2020-07-23: For today's #haskell problem, let's read in a JPG (o' FLAH'z!) and write it out as a TIFF ... for, you know, like: an image processing/classification exercise, at some later date. Ooh! TIFFY! TIFF saved from loaded JPEG image.
- 2020-07-22: For today's #haskell problem we extract data from JSON returned from a REST endpoint. The #haskell solution is declarative/functional-composition goodness to parse data from JSON returned from a REST endpoint.
- 2020-07-21: We ping a public API REST endpoint for today's #Haskell problem. For today's #haskell solution, simpleHttp in Network.HTTP.Conduit does the trick!
- 2020-07-20: For today's #haskell problem we read a file that contains a JSON message and parse it.
- 2020-07-17: Oops! Where has the time gone? That's today's ... I mean, YESTERDAY's, #haskell problem.
- 2020-07-16: And now, for something completely different: today's #haskell problem has us reading a file, parsing the data, and ranking the results. #haskell solution to which level is most recruit-efficient for a dark chest.
- 2020-07-15: For today's #haskell problem, we pull what we've done so far all together and compute today's pairings, given historical context.
- 2020-07-14: For today's #haskell problem, we pull what we've done so far all together and compute today's pairings, given historical context.
- 2020-07-14: For today's #Haskell problem, we look at using our historical context of pairings to answer questions for future pairings.
- 2020-07-13: Now that we've selected pairings for today, let's store those pairings into an historical context for today's #haskell problem.
- 2020-07-08: Pairing and ... 'Mobbing' (?) ... okay, really??? is our game for today's #haskell problem. A solution to the simple pairing-problem.
- 2020-07-07: For today's #haskell problem, we lay a foundation for building a team-pairing app. This day's problem addresses a History-type to provide context to the pairing-algorithm.
- 2020-07-06: For today's #haskell problem, we look at finding the spanning trees of a graph.
- 2020-07-02: Today's #haskell exercise finds us (acyclic) pathing though a simpler, yet-not-fully connected, graph.
- 2020-07-01: For today's #haskell problem we find cycles in graphs, ... MOTORcycles in graphs! AHA! AND MAKE MINE A DUCATI! ON FYE-YARRRR! 🔥 ... no ... wait ... Oh, well. #GraphTheory
June 2020 1HaskellADay Problems and Solutions
Thursday, October 17, 2019
February 2019 1HaskellADay Problems and Solutions
- February 20th, 2019: Wednesday's #haskell problem: we've got words, now let's find words that start with ... 'x'.
- February 19th, 2019: Tuesday's #haskell problem: now that we have a word finder, let's pretty-print the results!
- February 18th, 2019: Monday's #haskell problem is to come up with sets of wordsusing only a set of supplied letters. Monday's #haskell solution has some trickiness around empty sets: this, we call 'fun.'
Monday, February 18, 2019
April/May 2019 1HaskellADay 1Liners
- May 27th, 2018:
data F = F { a, b, c :: String }
data Stamped a = { time :: Day, stamped :: a }
f :: Stamped F -> String
output of f x is "time a b c" for the respective values of time, a, b, c
Is there some monadic / applicative elegant definition that does this? - Nickolay Kudasov @crazy_fizruk
f = intercalate “ “ . sequence [ show.time, a.stamped, b.stamped, c.stamped ] - Nickolay Kudasov @crazy_fizruk
f = intercalate " " <$> http://pure.show .time <> (sequence [a, b, c]).stamped
A bit trickier, but shorter and uses stamped once. - April 13th, 2018: given f :: [a] -> b -> [c]
where c is a derived from g :: a -> b -> c
You have [a] and [b]
Write a function h :: [a] -> [b] -> [c] from f
January 2019 1HaskellADay Problems and Solutions
- January 30th, 2019: Wednesday's #haskell problem is to take the JSON-y articles and the HTML-encoded articles and sort them by id and by date.
- January 29th, 2019: For Tuesday's #haskell problem we convert JSON-like strings to valid HTML strings, handling irregularities (gracefully!) in the input data as we go. For Tuesday's #haskell solution we convert text to text when you're not sure of the structure a priori.
- January 28th, 2019: Hello, Haskellers! Happy New Year! Monday's #haskell problem is a little warming-up JSON parsing exercise to get back into the swing of things. Monday's #haskell solution uses the Data.Aeson library to parse the JSON into Haskell data structures.
Subscribe to:
Posts (Atom)










