- 2020-08-31:
>>> :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)
_val
is unused. Curry it away. - 2020-08-28:
rmFront :: Set Char -> String -> String
rmFront 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
Subscribe to:
Posts (Atom)