- July 7th, 2017:

In LU-decomposition of matrices you have square P-matrix:

[[1,0..],

[0,2,0..],

[0,0,3,0..],

...]

For matrices of n² size

Code that- ∃! David Turner @DaveCTurner
- matrix n = let td = take n . drop 1 in td [td $ replicate i 0 ++ [i] ++ repeat 0 | i <- [0..]]

## Tuesday, August 1, 2017

### July 2017 1HaskellADay 1Liner

## Monday, July 31, 2017

### July 2017 1HaskellADay Problems and Solutions

- July 26th, 2017: We look at unifying fresh variables to ground terms for today's #haskell problem. And we have unification working for free variables and ground terms for today's #haskell solution.
- July 25th, 2017: We look at the beginnings of unification with ground terms for today's #haskell problem. Today's #haskell solution shows unification of ground terms in a monadic domain.
- July 24th, 2017: Commuters today occupy my mind for today's #haskell problem. A little reasoning, a little harsh reality, and we have today's #haskell solution.
- July 20th, 2017: I didn't go for my morning jog, so today's #haskell problem looks at running ... expressions. Eheh. For today's #haskell solution, some people run on empty, but I run on LOGIC! ... same thing.
- July 19th, 2017: Today's #haskell problem is our first step in our scheme to reasoning! MWA-HAHA! via the Reasoned Schemer. Today's #haskell solution:some days are #s; some days are #u

- July 7th, 2017: It's FRIDAY, and you know what that means? SCRABBLE DAY! for today's #haskell problem
- July 6th, 2017: For today's #haskell problem we invert a matrix to solve a system of equations.
- July 5th, 2017: For today's #haskell problem we have a * b = c ... HOW HARD CAN THAT BE? #famouslastwords The #haskell solution took like a whole second! THAT WAS HARD!
- July 4th, 2017: Boys and girls! Gather 'round as I spin you a story of Jemima and Roland for today's #haskell problem.
- July 3rd, 2017: Today's #haskell problem is all 'bout the Ord, 'bout the Ord, 'bout the Ord. No Functor. Today's #haskell solution uses a little sorting logic (not sordid logic; that's different) to show Jim is the eldest.

## Friday, July 7, 2017

### June 2017 1HaskellADay 1Liners

- June 17th, 2017:

f :: (a, [a]) -> [a] -> [a]

f (c, w1) w2 = c:w1 ++ w2

Define f points-free - bazzargh @bazzargh (++).uncurry(:)
- Felt there must be a nicer way to exploit symmetry of mappend.uncurry(mappend.pure) but can't find it

## Monday, July 3, 2017

### June 2017 1HaskellADay Problems and Solutions

- June 21st, 2017: Today's #haskell problem connects to and queries a SQL database of your choosing.
- June 16th, 2017: Today's #haskell problem has us interacting with the OS environment in anticipation of SQL database queries. Today's #haskell solution uses Applicative Functors to string together values we collect from the OS environment.
- June 15th, 2017: Today's Haskell problem comes by way of @aisamanra, Mr. Lists-are-Mu-functions-in-the-function-of-Mus. Today's #haskell solution shows Lists are Mu-functors! ... now, making them instances of type-classes, however ...
- June 14th, 2017: Today's #haskell problem is brought by way of @matthieubulte: approximating solutions with Runge-Kutta. The #haskell solution shows I can (ψ, ε, k) with the best of them! AHA! ... but is it the CORRECT solution? 🙄
- June 6th, 2017: In today's #haskell problem, we go clockwise around a binary tree, because ... we've had one too many?

## Friday, June 16, 2017

### May 2017 1Liners 1HaskellADay

- May 10th, 2017:

Define (^) :: (a -> a) -> Int -> (a -> a)

The 'power'-function where f ^ 3 = f . f . f - Conor McBride @pigworker flip ((ala Endo foldMap .) . replicate)

## Wednesday, June 7, 2017

### May 2017 1HaskellADay problems and solutions

- May 25th, 2017: Today's #haskell problem looks at the interconnectedness of languages as a graph.
- May 24th, 2017: Today's #haskell problem continues the exploration of spoken language roots catalogued in @wikidata. We present the first half of the #haskell solution that allows us to parse @wikidata results with optional values.
- May 23rd, 2017: I preface today's #haskell problem with a discussion on dirty/muddled data in @wikidata then continue onto languages. Today's #haskell solution shows us, e.g.: Cornish, Welsh and Breton are in the Brythonic language family. @wikidata
- May 22nd, 2017: Today's #haskell problem looks at spoken languages catalogued in @wikidata. Today's #haskell solution shows us @wikidata has NOTHING for the count of ENGLISH-speakers! #strangebuttrue
- May 17th, 2017: The NSA called. They are wanting the solution to today's #haskell Pentagon-number problem. Now.
- May 16th, 2017: Today's #haskell problem ... and Madonna! ... want you to justify my num! We find out that ALL YOUR BASE ARE BELONG TO US in today's #haskell solution
- May 15th, 2017: Today's #haskell problem warns us: "ACHTUNG, LOOKENPEEPERS! ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN." Today's #haskell solution taught me SO MUCH German. I mean SO MUCH!
- May 10th, 2017: For today's #haskell problem: when doing egg-arithmetic, we do not things by halves! ... or, perhaps, we do! Today's #haskell solution is EGGS! EGGS AS A POWER FUNCTION! EGGS EVERYWHERE!
- May 8th, 2017: Today's #haskell problem puts us 🎶 "Back on the Hang Gangs!" 🎶 Today's #haskell solution: "We must, indeed, all hang together or, most assuredly, we shall all hang separately."
- May 5th, 2017: HAPPY #CincodeMayo ... BUT ON A TUESDAY?!? What year was that, then? Today's #haskell problem. Today's #haskell solution shows Cinco de Mayo happens EVERY YEAR?!? Who da thunk it?
- May 3rd, 2017: Today's #haskell problem: April, May, and June are three sisters, and you have to find their ages. ... #awkward. Today's #haskell solution we have the old 1, 2, 3 sisters. Not that I'm saying these sisters are old. Not me. Nope.
- May 2nd, 2017: Ah! May! When Spring is in the Air! And #haskell-ers thoughts turn to Love* *solving today's problem. Today's #haskell solution presents a conundrum: Is the solution "spring" or "spring"? Hm. Tough call!
- May 1st, 2017: Happy May Day, #haskell-ers! Today we combat the academic illness: dafundzarlow ... let that sink in. Today we see two solutions to the #haskell problem of budgeting for cake and candy at Maura's school party. And to those of you who think #haskell has no practical application? Pooh on you! BUDGETING CAKE AND CANDY AT PARTIES IS TRÈS PRACTICAL! 😡

## Wednesday, May 10, 2017

### April 2017 1HaskellADay 1Liners

- April 14th, 2017: given

eitherOr, neitherNor :: Eq a => a -> a -> a -> Bool

Is eitherOr not neitherNor?

Prove or disprove. - April 14th, 2017: given

neitherNor :: Eq a => a -> a -> a -> Bool

andNot :: Eq a => a -> a -> Bool

How do you compose neitherNor 1 0 and andNot 4? - April 11th, 2017:

opts :: Credentials -> Options

opts c = defaults & auth ?~ basicAuth (pack $ keyToken c) (pack $ secretToken c)

point-free-itize

given:

data Credentials = Credentials { keyToken, secretToken :: String }

and (?~) and (&) are from Control.Lens

Snaps for elegance

The above code from quillio/Twillo.hs by ismailmustafa

## Monday, May 1, 2017

### April 2017 1HaskellADay Problems and Solutions

- April 26th, 2017: Today we do SCIENCE! (ballistic physics, actually) with #haskell.
- April 25th, 2017: "MOM! MOM! NO BOOK!" Today's #haskell problem: help little Johnny or little Jane's mom find the book! Today's #haskell solution solves mom + mom + no == book, where k == 9 in the blink of an eye with SCIENCE!
- April 21st, 2017: Today's #haskell problem analyzes @wikidata when it has very poor data-quality and -quantity. #Alaska
- April 19th, 2017: Today's #haskell problem looks at autom(agic)ally generating a SPARQL eye-color query. Today's solution gives EyeColors reified to #haskell values from a @wikidata SPARQL query
- April 18th, 2017: Today's #haskell problem takes on the HUGE task of automating writing simple SPARQL queries. Today's #haskell solution presents a simple, well-typed @wikidata SPARQL query builder.
- April 17th, 2017: We look at US States and their Capitals as SPARQLwikidata.org query for today's #haskell problem. For today's #haskell solution we had to drill down into depth of #wikidata resulting JSON to get our State Capitals.
- April 14th, 2017: Today's #haskell problem we make our first foray (again) into the world of @wikidata. What color are your eyes? We get our results back as JSON from our wikidata.org SPARQL query for today's #haskell solution.
- April 13th, 2017: For today's #haskell problem we have a little multiplication puzzle. Today's #haskell solution is 'Prolog-escque.' What would your approach be? Oh, and function-composition with (<*>)
- April 12th, 2017: Today's #haskell problem is a little word puzzle via the Mensa Genius Quiz-a-Day Book by Dr. Abbie Salny. Today's #haskell solution finds you looking rather smart, I must say!
- April 7th, 2017: You're decorating for Spring so you need to write a constraint solver because you're in #Mensa for today's #haskell. tfw you write all these generate and test functions and replace them with a simple filter application #haskell
- April 6th, 2017: Today's #haskell problem is (kinda) based on the OS upon which all other OS's bow down before: FORTH. Fight me. And today #haskell solution we find a use for the </> operator.
- April 5th, 2017: Today's #haskell problem looks at the rise of #bitcoin prices over the past year. Today's #haskell solution runs investment scenarios over a year of historical #bitcoin price data

## Tuesday, April 11, 2017

### March 2017 1HaskellADay 1Liners

- 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

## 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.

## Monday, March 13, 2017

### January 2017 1HaskellADay 1Liners

- January 31st, 2017:

You have d = "3.461497957769017000D+07"

define parseDouble :: String -> Double

(n.b.: (read d) :: Double throws an error) - bazzargh @bazzargh uncurry (*) (bimap read ((10^).read.(dropWhile(`elem`"0+D"))) (break (=='D') d))::Double
- January 31st, 2017: Given

e :: FilePath -> [String] -> [Epoch]

readEpochs :: FilePath -> IO [Epoch]

readEpochs f = e f . lines <$> readFile f

point-free-itize readEpochs - Astynax Pirogov @alex_pir uncurry fmap . (((. lines) . e) &&& readFile
- January 30th, 2017: Given

parseNum :: String -> Maybe (Float, String)

define: dropNum'' :: String -> Maybe String

points-free in terms of parseNum - matt @themattchan dropNum" = fmap snd . parseNum
- January 30th, 2017: For

parseHeader :: String -> Maybe String

parseHeader str = match "Start " str <|> match "Finish " str

eliminate redundancies - mconcat . ([match] <*> ["Start ", "Finish "] <*>) . pure
- Nickolay Kudasov @crazy_fizruk If you're allowed to use Monoid instead of Alternative, how about this version?

foldMap match ["Start", "Finish"] - Andreas Källberg @Anka213 My solution was

parseHeader str = foldr1 (<|>) . map (`match` str) $ ["Start", "Finish"]

But that's longer than the original. - January 25th, 2017:

given f is type: f :: Int -> a -> Bool

for: g :: a -> Bool

g = (||) . f 2 <*> f 27

rewrite g using f only once in the definition - Denis Stoyanov @xgrommx ugly version but

(liftA2 . liftA2) (||) ($2) ($27) f - January 19th, 2017:

import Data.Tree.Merkle

mkleaf :: Show a => a -> Leaf a

mkleaf = uncurry Leaf . (show . hashDatum &&& id)

redefine using (<*>) - Denis Stoyanov @xgrommx smth like

mkleaf = uncurry Leaf . show . (hashDatum <$> (,) <*> id)

mkleaf = uncurry Leaf . show . (liftA2 (,) hashDatum id) - January 19th, 2017:

mkbranch1 :: Leaf a -> Branch a

mkbranch1 = uncurry Twig . (uncurry childrenHash . (dataHash &&& dataHash) &&& id)

redefine using (<*>)s(?)

## Tuesday, February 28, 2017

### February 2017 1HaskellADay Problems and Solutions

- February 28th, 2017: Today's #haskell problem is a 'little' side-excursion to ask: why don't finite lists have embedded length? So, the #haskell solution has lists with embedded length in a few lines of code. Sweet!
- February 27th, 2017: Gearing up to take on large sequences and subsequences for today's #haskell problem. Subsequences of size x delivered in today's #haskell solution, but not a silver bullet!
- February 24th, 2017: Today's #haskell problem invites you to RULE THE GALAXY TOGETHER AS FATHER AND SON! with Binomial distributions. Darth Vader was right (then again, when is he ever wrong?) when he said: "Binomial distributions rock!" ... probably
- February 23rd, 2017: Today's #haskell problem is to find protein motifs (specifically Nglycos) in FASTA files. With UniProt files that do not redirect, we have today's #haskell solution to finding Nglycos motifs in FASTA files.
- February 22nd, 2017: Today's #haskell problem looks at improving fibonacci to be more correct and more memory efficient. Today's #haskell solution is where we fib down low on the nacci, yo.
- February 21st, 2017: For today's #haskell problem we look at BUNNEHZ! LOTS OF FIBONACCI BUNNEHZ! Oh, ... some of them die. It's very sad.
ERMIGOSH!

SO! MANY! BUNNEHZ!

for today's #haskell solution. - February 20th, 2017: length list is O(n) ... is there a better way than length? We look at that in today's #haskell problem. Usually you're doing something to a list other than length; today's #haskell solution uses that other information.
- February 17th, 2017: Today's #haskell problem looks at offspring of parents with multiple traits. My answer for today's #haskell problem includes crossing traits, and needs work on probabilities!
- February 16th, 2017: Today's #haskell exercise looks at genotypes and the possible outcomes of a genotype in offspring. Today's #haskell solution has fun with combinatorics and probability distributions to compute genotypes in offspring
- February 15th, 2017: Today's #haskell exercise examines what it is for a probability distribution to be an applicative functor. Distributing functions over values (probabilistically) gets us today's #haskell solution.
- February 14th, 2017: Oh, and from all of us at @1HaskellADay to all our dear fans: KAWWWWAAAAAAIIIIIII!!! Happy St. Valentine's Day!
- February 14th, 2017: Today's #haskell problem looks at probability distributions. Today's #haskell solution shows how to condense probability distributions for Ord keys.
- February 13th, 2017: We look for the majority element in small lists, then in large lists for today's #haskell problem. As of now, only 953 IN THE WORLD have solved this #rosalind problem. Are you going to be one of the elite 1,000 to have solved it? Today's #haskell solution traverses only some of the list to find the majority element.
- February 10th, 2017: Today's #haskell problem is about "binary search," according to rosalind.info; but I think this is easy. Using Data.Map.Map today's #haskell solution finds the indices in binary-search time!
- February 9th, 2017: For today's #haskell problem, we look at fibonacci numbers, ... then we go large. Today's #haskell solution is a little bit of fibo-nacci-ness ... and more than just a little bit!
- February 8th, 2017: Today's #haskell problem looks at a population by genotype to compute expected offspring via rosalind.info. We find out that there are a LOT of bunnies out there with dominant genotypes for today's #haskell solution.
- February 7th, 2017: Today's #haskell exercise looks at sets from sets using set-operators... not that I'm a Set theorist, or anything...
*update:*I've added a bonus to today's #haskell exercise: read in a pair of gzipped sets from rosalind.info and write out the answer to file. Today's #haskell solution uses Data.Set operators and a bit of category theory. Answer is a set of very big sets! - February 6th, 2017: Today's #haskell problem we return to rosalind.info to look at number of subsets of sets and applications. Sections rule the day for today's #haskell solution to subsets of sets
- February 3rd, 2017: Today's #haskell problem shows us that LOVE is a ROSE, but you better not PINK it ... wait: PICK it. Yeah. #pinkrose Today's #haskell solution taught me the word 'pone' and what that word means. Huh. 'pone.' Whatevs.
- February 1st, 2017: Today's #haskell problem gets distances between the Earth and Mars. Also, we'll plot orbits as a bonus. Today's #haskell solution computes distances using planetary #ephemeris data.

## Tuesday, January 31, 2017

### January 2017 1HaskellADay problems and solutions

- January 31th, 2017: For today's #haskell problem we look at #ephemeris data (double-precision triples) for EMbary (Earth/Moon) and Mars. We parse some big-Ds (double-precision numbers) to get Earth and Mars orbital #ephemeris data from the JPL.
- January 30th, 2017: This week we'll be looking at JPL Earth and Mars Ephemeris data sets. Today's #haskell problem reads in Julian dates. Today's solution uses Prolog Definite Clause Grammars (DCGs) - in #haskell - to read the date string.
- January 27th, 2017: Today's #haskell problem is a little word-guessing puzzle. Today's #haskell solution is another puzzle: To which band do witches band? Will we ever know?
- January 26th, 2017: Today's Haskell exercise tally the word-frequency of a file, so: tally-ho! Today's #haskell solution shows me 'County' is the most popular word in #haskell?!? but okay.
- January 25th, 2017: For today's #haskell exercise, we see what Haskell files are in a directory, eh? Today's #haskell solution to find the Haskell files in a directory structure got me all Monad-y down low on the IO!
- January 20th, 2017: For Today's #haskell problem we look at Merkle Trees of the #blockchain as Traversable.
- January 19th, 2017: Lastly, today's #haskell problem looks at the Traversable function: lastest via @Jose_A_Alonso @yoeight. Today's #haskell solution shows the First shall be the lastest
- January 18th, 2017: As sum is already defined for Traversibles, today's #haskell problem looks at average via @Jose_A_Alonso @yoeight. For today's #haskell solution we find the average of the elements of any Traversable type
- January 17th, 2017: Today's #haskell problem continues Traversable exploration by @Jose_A_Alonso @yoeight with minAF and maxAF...in O(1). So, we have today's #haskell solution for minAF, minT, maxAF, and maxT. lolneat!
- January 16th, 2017: Today's #haskell problem looks at find, any, and all as functions over Traversable types via @Jose_A_Alonso @yoeight. Today's #haskell solution not only defines anyAF and allAF but also the important gtfo, that is: find (> 5)-function.
- January 13th, 2017: Today's #haskell problem does 2 things: examines Applicative Functors (AF) and lets me say transpose...AF in a tweet. Today's #haskell solution shows a succinct applicative solution to transposeAF for matrices
- January 12th, 2017: Partial functions everywhere via @Jose_A_Alonso @bitemyapp! Today's #haskell exercise takes on maximum and minimum. We 'full-i-tize' the partial functions of minimal and maximal for all Foldable t in today's #haskell solution
- January 11th, 2017: Today's #haskell exercise handles the next pitfall from @Jose_A_Alonso @bitemyapp: Prelude partial functions, particularly for the evil List! Today's #haskell solution TOTALly unpartializes some Prelude list functions ... geddit? TOTALly? GEDDIT?
- January 10th, 2017: Continuing #haskell pitfalls review via @Jose_A_Alonso @bitemyapp we study Data.Text to process large text documents. Today's #haskell solution shows Dickens was ahead of his time, citing URLs in
*Christmas Carol*LIKE A WEB GANGSTA! - Side note: I had no problem processing 200k size text document using String, but, hey: knock yourselves out with Text for text processing.
- January 9th, 2017: For today's #haskell exercise we take a leaf from @bitemyapp via @Jose_A_Alonso and look into Data.Aeson quasiquotes. Using Data.Aeson.QQ today's #haskell solution basically wrote itself.
- January 6th, 2017: Today we look at combined US State SAIPE/poverty and debt data, rescale those data, and cluster the results #Haskell
- January 5th, 2017: For today's #haskell exercise we combine US State SAIPE/poverty data along with US State total and per capita debt. Today's #haskell solution on SAIPE/poverty data and US State debts has CHARTS! Never. Underestimate. Charts. 👌💯💯💯
- January 4th, 2017: Today's #haskell exercise we re-look SAIPE/poverty data, reorganizing by US State instead of by US County. We collate US State SAIPE/poverty data, then do a bit of analysis with a pensé about results thrown in at the end.
- January 2nd, 2017: For the beginning of AD 2017, today's #haskell exercise wishes you a less divisive year than the last. LITERALLY!

## Thursday, January 19, 2017

### December 2016 1HaskellADay 1Liners

- December 22nd, 2016: f :: (Either a b, c) -> Either (a, c) (b, c), define f, snaps for elegance, e.g.: f (Left 4, "Hi") = Left (4, "Hi")
- bazzargh @bazzargh uncurry (flip (join bimap . (,) ))
- Denis Stoyanov @xgrommx need (Left 4, "Hi") = Left (4, "Hi") but your version Left ("Hi", 4)
- Thomas D @tthomasdd Do tuple sections count? do I have access to Data.Bifunctor?
- f (eab,c) = bimap (,c) (,c) eab
- SocialJusticeCleric @walkstherain uncurry $ either ((Left .).(,)) ((Right .).(,))
- Denis Stoyanov @xgrommx or f (e, a) = (join bimap (\x -> (x, a))) e
- Nickolay Kudasov @crazy_fizruk most elegant IMO:

f (Left a, c) = Left (a, c)

f (Right b, c) = Right (b, c) - December 22nd, 2016: define a function that writes out an infinite, alternating stream of 1's and 0's as below.
- Philipp Maier @AkiiZedd mapM putStrLn $ join $ repeat ["0","1"]
- Eyal Lotem @EyalL join . repeat = cycle?
- mavant @mavant f = putStr "10" >> f
- Eyal Lotem @EyalL mapM putStrLn $ cycle ["0","1"]

- December 10th, 2016:

startsWith :: [String] -> String

points-free so that:

startsWith ["ΜΗΛΟΝ", "ΗΔΟΝΗ"] = "ΛΟ"

That is: (length list)+1 Char of each word - SocialJusticeCleric @walkstherain
- I prefer `uncurry (!!) . (Data.List.transpose &&& length)`
- but `map . flip (!!) . length =<< id` only uses the Prelude
- Nick @crazy_fizruk zipWith (!!) <*> repeat . length

## Sunday, January 1, 2017

### December 2016 1HaskellADay Problems and Solutions

- December 27th, 2016: For today's #haskell exercise we expand our inquiry of SAIPE/poverty data by analyzing by US State.
- December 26th, 2016: Today's #haskell exercise looks at partitioning data by each unit's 'size'; then we visualize the partitioned data. Today's #haskell solution shows we can cluster and analyze US counties by their relative sizes
- December 23rd, 2016: There are many (3000+) US Counties. Today's #haskell exercise visualizes them clustered by SAIPE/poverty data. Today's #haskell solution shows the US Counties clustered by SAIPE/poverty data visualized in @neo4j.
- December 22nd, 2016: For today's #haskell exercise we shift focus from SAIPE/poverty data to debt by US State, total and per capita. Today's #haskell solution shows US State debt, totals and per capital, with a caution about the IO monad in a REPL.
- December 21st, 2016: For today's #haskell exercise we look at clustering SAIPE/poverty data and looking at patterns in the clusters. Today's #haskell solution shows US counties fall in 4 clusters using SAIPE/poverty data with Los Angeles a stand out.
- December 20th, 2016: Today we look at enumerating US Counties from SAIPE/poverty data then determining their US State, deterministically. We find in today's #haskell solution that there a a lot of Counties of the US, so we index and enumerate them.
- December 19th, 2016: For today's #haskell exercise we make a set of (static) String values enumerable and indexible. On the shoulders of our previous parsing work, today's #haskell solution parses SAIPE data to index US State names.
- December 16th, 2016: Today's #haskell Exercise looks at score-cards for US Census data
- December 15th, 2016: For today's #haskell exercise, we're back looking at US Census data: SAIPE/poverty by State and county #DataAnalytics. Today's #haskell solution shows how to parse by-line whilst carrying-over structure-context from prior lines
- December 14th, 2016: Today's #haskell exercise we begin to look at qubits and pauli rotations on qubits. Today's #haskell solution represents Qubits and rotates |0> and |1> through the Pauli X operator.
- December 13th, 2016: Today's #haskell exercise looks at the US Census data and asks some by-State questions around incomes. Today's #haskell solution uses Network.HTTP and Applicative Functors to examine populations and mean/median incomes.
- December 12th, 2016: For today's #haskell exercise we observe a dinner-table conversation of a math professor and her husband. Today's #haskell solution shows us happiness for children is having a parent as a math professor. I know this.
- December 9th, 2016: Today is #FF on @1HaskellADay. I mean, that's today's #haskell exercise: Examine Twitter JSON for #FF-analytics. Today's #haskell solution shows us who NOT to #FF if you want the follow back. Doesn't it.
- December 8th, 2016: Today's #haskell exercise comes to you all the way from Smyrna! Construct a word-square. And from 2000 common English words we have #haskell solutions for the 3x3 and 4x4 word-squares

- December 6th, 2016: Today's #haskell exercise will look at EMA/Exponential Moving Averages to analyze trends of, e.g. #BitCoin. Today's #haskell solution inlines state into the EMA-recursive function to analyze #BitCoin price history.

- December 5th, 2016: Today's #haskell exercise we look at the SMA/Simple Moving Average as a trend-estimator for, e.g.: #BitCoin price. Today's #haskell solution uses the SMA-function as a Comonad. Below are 1 year and 3 months of #BitCoin SMA-analyses.

CORRECTION! SMA 15 and SMA 50 are industry norms in the markets. Corrected (and generalized) #haskell solution here.

- December 1st, 2016: For today's #haskell exercise we look at a larger data set with a year's worth of BitCoin price history.
I love the #haskell standard library. I love that you can write today's solution: #BitCoin prices in one line of code.

Subscribe to:
Posts (Atom)