- October 20th, 2017:

You have a list of numbers: [1,2,3,4]

You have a list of the same length of number fns: [succ, id, id, succ]

You want: [2,2,3,5]
- 🇪🇺 Cλément D 🌈 🐇 @clementd zipWith (flip ($)) ?
- he adds: `zipWith (flip id)` is a bit shorter tho

- Simon Courtenage @SCourtenage zipWith ($) [succ,id,id,succ] [1,2,3,4]
- lukasz @lukaszklekot getZipList $ ZipList [succ, id, id, succ] <*> ZipList [1, 2, 3, 4]
- Alexey Radkov @sheshanaag (map (uncurry ($)) .) . zip

- October 5th, 2017: "reverse the sequencing"

You have [[(1,2),(1,3),(1,7)],[(9,2)],[(11,3)]]

You want [(1,[2,3,7]),(9,[2]),(11,[3])]
- bazzargh @bazzargh map ((,) <$> head.(map fst) <*> (map snd))
- bazzargh @bazzargh map ((first head).unzip)
- Chris Martin @chris__martin \x -> [(a, b : fmap snd xs) | Just ((a, b) :| xs) <- fmap="" li="" nonempty="" x="">
- Simon Courtenage @SCourtenage fmap (\x -> (fst . head $ x, fmap snd x))
- Denis Stoyanov 🐜 @xgrommx Your solution nice) but u can do it with point free style like
- fmap(fst.head &&& fmap snd)

- Denis Stoyanov 🐜 @xgrommx My solution is ugly, but I wanna to solve it with traverse)
- fmap(first head . traverse (first (:[])))

- Andreas Källberg @Anka213 map$fst.head&&&map snd
- Scott Fleischma @scottfleischman

traverse

$ _1

(\case

[y] -> Just y

_ -> Nothing

. nub

)

. unzip

:: [[(Int, Int)]] -> Maybe [(Int, [Int])]
- Scott Fleischman @scottfleischman

let
sing [] = Left "Too few"

sing [x] = Right x

sing (_ : _) = Left "Too many"

valid = sing . nub

go = _1 valid . unzip

in traverse go
- matt @themattchan map ((head *** id ) . unzip)

- October 3rd, 2017:

you have [(1,[2,3,4]),(10,[5,6,7])]

you want [(1,2),(1,3),(1,4),(10,5),(10,6),(10,7)]

or, generally: [(a,[b])] -> [(a,b)]

Go!

- bazzargh @bazzargh (uncurry (zip . repeat) =<<)
- Bruno @Brun0Cad (=<<) sequence
- Denis Stoyanov 🐜 @xgrommx fmap (uncurry (liftA2(,) . (:[])))
- Darren G @Kludgy I like that this doesn't unnecessarily implicate the sequentiality of bind.

- Darren G @Kludgy Funny this same product came up at work last week.

concatMap $ \(a,bs) -> fmap (\b -> (a,b)) bs

- October 31st, 2017: Tuesday's #haskell problem has you save off the special characters from yesterday's exercise to a properties file. Today's #haskell solution: properties file created. We also output the special characters in context, which is nice.
- October 30th, 2017: Monday's #haskell problem we contextually find special characters in documents. Whoa! Today's #haskell solution finds that there are a lot of special characters in these documents!
- October 27th, 2017: 2017-10-27, a date where the month/day is an anagram of the year. How many days from today are anagrams of 2017? What are they? Today's #haskell solution: and we have a winner! A bunch of winners, actually for date anagrams in 2017.
- October 26th, 2017: Today's #haskell problem does what Google calls artificial-artificial intelligence analyses on NYT article archives. Today's #haskell solution: from one spreadsheet comes many! Nietzsche would be so proud of me rn.
- October 25th, 2017: Today's #haskell problem, instead of counting articles by topic, we divide articles into browsable/graphable topics. Today's #haskell solution we graph a slice of our NYT article archive.
- October 24th, 2017: Tuesday's #haskell exercise we read back in the articles stored as JSON then partition them by subcategory. Okay! Partitioned articles for today's #haskell solution.
- October 23th, 2017: Monday's #haskell problem we start to analyze our NYT article archive, selecting a topic to dissect. In the #haskell solution we read articles from our data store, then we save them out to file as JSON.
- October 20th, 2017: Today's #haskell problem: NYT article archive through a different lens, as nodes and relations in a graph database. Today's #haskell solution: we wanted #graph we got graph.
- October 19th, 2017: Customer: "Ooh! We love the charts you're making for us, but..." TIL that customers have big 'but's. Today's #haskell solution: And now we can read .gitignore-style configuration files.
- October 18th, 2017: Today's #haskell problem we archive the topics (and article topicality) of the NYT article set. We group data; we regroup data. Ah! The life of a Data Scientist! Today's #haskell solution via @d3js_org #dataviz
- October 17th, 2017: Today's #haskell problem: we build an app that queries the database and generates circle reports. A bit of database work then a bit of JSON to get us our charting tool for today's #haskell solution.
- October 16th, 2017: Thanks to @ahnqir we're looking at cities and skyscrapersfor today's #haskell problem. Ooh! Bar chart! Today's #haskell solution exclaims (proclaims? declaims?) "Look at Hong Kong with its highrises!"
- October 13th, 2017: Yesterday we built a little app (scanner), today we build something a little bigger: a #haskell #ETL application! Today we pull together NYT article parsing and database functions to create a #haskell ETL app! YAY!
- October 12th, 2017: Thursday's #haskell exercise is to build an app named scanner. I, for one, welcome our scanner overlords. Today's #haskell solution is the little scanner app that could!
- October 11th, 2017: Wednesday's #haskell problem: TIL that not all data in production is pristine. SHOCKER! So, okay, we know which document we are in when the less-than-pristine data fandangos on our perfect parser. Good.
- October 10th, 2017:

Boss: "That's a good chart, but can I have it in a spreadsheet?"

me: "But ..."

Boss: "Now."

Today's #haskell solution:

me: Ya wanna spreadsheet, boss? HERE'S YER SPREADSHEET! YA HAPPY?

Boss: um, ... 'yes'?
- October 9th, 2017: Today's #haskell problem asks: can we chart just a few of the topics of the week archive of the NYT? Sure we can! Today's #haskell solution provides the top 5 topics then all topics with 10 or more articles.

- October 5th, 2017: Friday's #haskell exercise works with data-as-JSON and charting the analyses on the data. Today's #haskell solution has a LOT of circles in its visualization of NYT article topics. A LOT.
- October 4th, 2017: Today's #haskell exercise uses the NYT archive we've stored to look at trending topics and to visualize them. Today's #haskell solution we grab and group data we have in a data store.
- October 3rd, 2017: Building a set of words you key off of in your search for articles? MemoizingTable is today's #haskell problem. We parse a sliced of the NYT article archive and store articles and their respective subjects.

- October 2nd, 2017: Monday's #haskell problem looks at representing SQL join- or pivot-tables generally. Today's solution uses the Pivot values in #haskell to store data on a remote PostgreSQL database.

- September 26th, 2017:

art2RawNames art = Raw (artId art) <$> (Map.lookup "Person" $ metadata art)

curry away the 'art' var. ref: Y2017.M09.D26.Exercise
- September 19th, 2017: The #1Liner to follow (next tweet) is a question based off a code snippet from Y2017.M09.D18.Solution. What is a better/more elegant definition?

fmap (wordStrength . wc) (BL.readFile filename) >>= \dict ->

return (Map.insert filename dict m)

Reformulate. Curry the dict-ref.

- September 29th, 2017: Friday's #haskell problem uses name-parsing to post parsed names into PostgreSQL database and join them to articles. Today's #haskell solution extracts rows of raw names associated with articles, parses then stores them in PostgreSQL.
- September 28th, 2017: Thursday's #haskell problem inserts reified articles into PostgreSQL database, including names, and throws confetti! Today's #haskell solution inserts the articles from our compressed archive. YAY! Throw confetti!
- September 27th, 2017: Wednesday's #haskell problem looks at parsing names in various formats. Today's #haskell solution solves the name-parsing problem by parsing each name-form in turn.
- September 26th, 2017: Tuesday's #haskell problem looks at staging data on PostgreSQL for deferred processing using Haskell for ETL. Today's #haskell solution transforms RawNames to JSON and uploads it to a staging table on the PostgreSQL database.
- September 25th, 2017: Friday we took a compressed archive and broke that into individual articles. Today we divide articles into sections. Today's #haskell solution uncovers structure bit by bit as we reify an article structure from a block of text.
- September 22nd, 2017: Today's #haskell problem we're going to scan into an 'unstructured' set of documents and start to look for structure. Welp, today's #haskell solution is a 'start': from one blob to 11 blocks of raw text. We'll dig in deeper next week.
- September 21st, 2017: TOMORROW's #haskell problem (announced a wee bit early) queries PostgreSQL database to fetch keyword dictionary state. Today's #haskell solution picks up where we left off yesterday then computes the top keywords across articles.
- September 20th, 2017: Today's #haskell problem asks to push keywords extracted from article onto a PostgreSQL data table. Today's #haskell solution pushes keywords – PUSHES KEYWORDS REAL GOOD – to a PostgreSQL database.

- September 19th, 2017: So we've encoded keywords into Ints, today's #haskell problem decodes those ints back to the keywords. Today's #haskell solution 'reverses the arrows' of the Map, decoding a keyword from an index
- September 18th, 2017: Today's #haskell problem computes the relative word 'strength' of each word in a document. Today's #haskell solution breaks the word-strength problem into small pieces then foldM's over the small pieces.
- September 15th, 2017: Today's #haskell problem takes a look at KEA/Keyword Extraction Algorithm. Ooh, doggies! State IO Map KeyWord something-or-otherfor today's #haskell solution.
- September 14th, 2017: Today's #haskell problem involves using the simple interface to PostgreSQL to insert rows of data. Ooh! Exciting! Today's #haskell solution uses ToRow and ToField to insert Haskell values into #PostgreSQL #DaaS instance! lolneat!
- September 13th, 2017: Today's #haskell problem asks the article names have encoded Julian dates ... OR DO THEY? So, in solving today's #haskell problem, I realized THOSE AREN'T JULIAN DATES! THOSE ARE DATE DATES!
- September 8th, 2017: Continuing our ETL exploration with a load/compress/storefor today's #haskell exercise. Today's #haskell solution shows load/compress/store ... that's a word now.
- September 5th, 2017: Today's #haskell exercise is to build a directory web serviceusing the Snap framework [or a framework you prefer]
- September 4th, 2017: Today's #haskell problem reads in source documents and does some word frequency analyses. Today's #haskell solution shows, surprisingly, 'the' is the most popular English word. Or, not so surprisingly.
- September 1st, 2017: Today's #haskell problem #SPARQL-queries wikidata.org to fetch countries' populations for FB analysis. Yesterday, India won FB by population, today we have a surprise winner in Thailand for FB by percentage user base.

- August 1st, 2017:
f :: (Maybe a, b) -> Maybe (a, b) Define points-free.
- August 1st, 2017:

Given f above and f a and f b are mutually exclusive in Maybe monad, define

g :: Maybe (a, b) -> Maybe (a, b) -> (Maybe a, b)

points free
- August 1st, 2017:

Now, let's define the dual of f

f' :: Maybe (a, b) -> (Maybe a, b)

points free

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