- March 30th, 2017:

divide :: (a -> Either b c) -> [a] -> ([b], [c]) This function is somewhere easy to get to, right?

via @fmapE - @fmapE: divide f = foldr (either (first . (:)) (second . (:)) . f) ([], [])
- SocialJusticeCleric @walkstherain divide f = Data.Either.partitionEithers . fmap f
- andrus @andrus divide f = foldMap $ (swap . pure . pure ||| pure . pure) . f
- matt @themattchan divide = partitionEithers ... map where ... = (.).(.)
- March 13th, 2017:

Palindromes have nothing to do with today's #haskell problem of anagrams. So what.

Define

palindrome :: String -> Bool

elegantly - SocialJusticeCleric @walkstherain all id . (zipWith (==) =<< reverse)
- SocialJusticeCleric added: TIL Data.Foldable.and
- bazzargh @bazzargh ap (==) reverse?
- March 13th, 2017:

type Bag a = Map a Int

anagram :: Ord a => [a] -> [a] -> Bool

anagram src = (== Bag.fromList src) . Bag.fromList

Redefine with <*> - Denis Stoyanov @xgrommx why not?

anagram = (==) `on` Bag.fromList

## Tuesday, April 11, 2017

### March 2017 1HaskellADay 1Liners

## Wednesday, April 5, 2017

### March 2017 1HaskellADay Problems and Solutions

- March 31st, 2017: We look at pedestrian-vehicular injuries and fatalities for today's #haskell problem. Today's #haskell solution creates an array of maps to get our scanr-solution. I'm game.
- March 29th, 2017: What with #marchmadness it's time we put #haskell to solving this task, besides: BABY NEEDS A NEW PAIR OF SHOES!
- March 28th, 2017: You ever have one of those days where you know you were supposed to do SOMEthing? "Today's" #haskell problem.
- March 24th, 2017: Tennis is very good exercise, and a very good #haskell exercise for today. AHA! #probability
- March 23rd, 2017: Today's #haskell problem examines the importance of wearing matching ... RED?!?! ... socks? Remember that one (one?) wacky professor in college? Today's #haskell solution shows that was the tip of the iceberg.
- March 22nd, 2017: Today's #haskell problem definitively proves Goldbach's Conjecture for ALL even numbers ... um, in a sample set. Today we definitively proved Goldbach's Conjecture. See you at the pub, then, eh?
- March 20th, 2017: Today's #haskell problem: 2 + 3 + 5 + 7 + 11 + ... what prime numbers can be written as a sum of consecutive primes? So there are primes from the sum of consecutive sequence of primes starting at 2, but there's a lot more to it, too!
- March 17th, 2017: Today's #haskell problem is brought to you by the letter 'P': primality and permutations. Today's #haskell solution shows this projecteuler.net problem has clear bounds, which made it a gimme for me.
- March 16th, 2017: If you break it down, finding the square-free numbers in a set of 614 numbers isn't that hard. Today's #haskell problem. Winnowing down makes testing for prime-square factors much easier in today's #haskell solution.
- March 15th, 2017: For today's #haskell problem we deconstruct the construction of the Pascal's Triangle. Today's #haskell solution involves some BIG NUMBERS! ... Good thing Haskell is a mathematical language, then! 😎
- March 14th, 2017: For today's #haskell problem, being π-day, we are going to look at the convergence of e, via projecteuler.net. Continued fractions are so easy in #haskell that it was embarrassing writing this code!
- March 13th, 2017: Today's #haskell problem comes by way of @HaggardHawks @NicWilko (Ult): an anagram-i-verifier-...thingie. Today's #haskell solution uses #Latin to solve the anagrammatic sonnet with a Q.E.D.-function (not really). Q.E.D. 😎
- March 10th, 2017: Categorizing snippets to languages by ... word-endings? Ah, bon?
- March 9th, 2017: "A little less conversation; a little more perfect matching of RNA strands, baby!" #haskell problem by Elvis Presley.

- March 7th, 2017: For today's #haskell exercise we look at nucleotide transitions and transversions. We solve today's #haskell problem using purine/pyramidine characteristics of nucleotide bases.
- March 6th, 2017: For today's #haskell problem we look at numbers of combinations of alternate RNA splicing. Today's #haskell solution was answered in 1 line. Sweet!
- March 3rd, 2017: Let's take a break from pathing today, because it's FRIDAY! Today's #haskell problem is about partial permutations. Today's #haskell solution shows choosey mothers choose JIF! ... and partial permutations, too! ... but OTOH: SKIPPY!
- March 2nd, 2017: In today's #haskell problem @geophf admits he's stupid, and in writing! Oh, and we look for the 'minimumest' path. AHA! Today's #haskell solution gives us a super-fast minimumest path through DNA strands, ... or does it? So, the error for last-element terminating early in minimumest path is corrected, but we still have work to do!
- March 1st, 2017: Informed, or guided, subsequencing? That's what we'll be looking at for today's #haskell problem. Today's #haskell solution shows that, even though informed, common subsequences explode for even small sequences.

Subscribe to:
Posts (Atom)