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

Reformulate. Curry the dict-ref.

return (Map.insert filename dict m)

# Typed Logic

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.

## Tuesday, October 3, 2017

### September 2017 1HaskellADay 1Liner problems and solutions

## Saturday, September 30, 2017

### September 2017 1HaskellADay problems and solutions

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

## Tuesday, September 19, 2017

### August 2017 1HaskellADay 1Liners Problems and Solutions

- 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

## Friday, September 1, 2017

### August 2017 1HaskellADay problems and solutions

- August 31st, 2017: Today's #haskell exercise is by way of @ahnqir. What are the percentage of facebook users by country? Today's #haskell solution charts FB users by country. GO INDIA!
- August 4th, 2017: For today's #haskell problem we are looking at the caesar cipher as a better rot13. And today's #haskell solution with rot, rot, roslein rot everywhere.
- August 1st, 2017: For today's #haskell problem we are parsing a string into word-tokens and munging/demunging them with rot13! WOOT! Munging plaintext and demunging cyphertext, oh, my!

## Tuesday, August 1, 2017

### July 2017 1HaskellADay 1Liner

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

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

Subscribe to:
Posts (Atom)