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

# 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, January 31, 2017

### January 2017 1HaskellADay problems and solutions

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

## Saturday, December 10, 2016

### October 2016 1Liner 1HaskellADay problem and solutions

- October 21st, 2016:

You have l1 :: [(v, [(k, x)])]

You need the transformation l2 :: [(k, [(v, x)])]

Redistribute v and k in one line

Props for elegance - Francisco T @aiceou redist xs = fromListWith (++) $ concat $ (map f xs) where f (a,ys) = map (\(x,y) -> (x,[(a,y)])) ys ... but k has to be 'Ord'

## Wednesday, November 30, 2016

### November 2016 1HaskellADay Problems and Solutions

- November 29th, 2016: For today's #haskell problem we have a DATABASE (world's smallest H-table) and we aim to fit a line to a time-series. In which a simple mean-gain curve actually fits pretty well with the data in today's #haskell solution
- November 28th, 2016: Today's #haskell exercise we start to look at some real-world data, looking at gains over time. Today's #haskell solution computes gains over time ... also works for losses, yes?
- November 23rd, 2016: Today's #haskell exercise looks at time-series as a 'thing.' Today's #haskell solution charts the projection of #ingress scores over time

- November 22nd, 2016: So many activities in November: #NaNoWriMo2016 and now #ingressyear4 awards. Today's #haskell exercise takes them on. Today's #haskell solution shows I need to ingress 88k points per day; let's get crackin'!
- November 21st, 2016: In honor of it being #NaNoWriMo2016 here's today's #Haskell coach to 'help' (to nag) you write MORE, HARDER, FASTER! Today's #haskell solution shows SOMEbody they'd better get CRACKIN' to finish the #NaNoWriMo2016 writing challenge!
- November 16th, 2016: Today's #haskell exercise focuses on the important things in life: coffee and chocolate!
Today's #haskell solution balances water well enough, but chocolate? That's a mite harder.
- November 15th, 2016: For today's #haskell exercise we look at simple unification on the Maybe-type. Today's #haskell solution is a little monadic/applicative logicto find that Amy is Amy. Surprise, surprise!
- November 14th, 2016: Today's #haskell exercise shows a little bit of Amy's family tree from the Mensa Genius Quiz-a-Day book
- November 11th, 2016: Today's #haskell exercise we tease out information from a Twitter API call to see who this @geophf-person really is! Somehow I got to solving two problems in one day, but OKAY, HERE WE GO! Information on a tweep from Twitter API JSON.
**BONUS:**November 11th, 2016: In honor of me solving today's problem yesterday, here's bonus #haskell problem: network of shared twitter followers. Today's #haskell solution shows that twitter follower networks can get a bit ... messy. MANY FOLLOWERS! SUCH WOW! (whispered: the shared follower network is a simple natural transformation from #categorytheory:`natx (++) twerpAsRel tweep1 tweep2`

Yeah)

- November 10th, 2016: Today's #haskell exercise: @1HaskellADay has followers. Tweep id 81457442 has followers. Are there shared followers? Today's #haskell solution uses natural transformation to find shared followers of 2 tweeps via the Twitter API JSON
- November 8th, 2016: We call the Twitter API directly to get a set of follower IDs to scan for today's #haskell exercise. Today's solution shows a simple (parsing) transformation from JSON to #haskell values
- November 2nd, 2016: Today's #haskell exercise explores a twitter social network along FOLLOWS-relations. BONUS lets you explore yours.
- November 1st, 2016: For today's #haskell exercise, we look at twitter users and their relations as a JSON-graph.

## Tuesday, November 1, 2016

### October 2016 1HaskellADay Problems and Solutions

- October 28th, 2016: Today's #haskell problem is to create a comprehensive set of score cards for top5s stocks and then cluster them.
- October 26th, 2016: Today's #haskell exercise looks at runs of stocks in the Top5s and sees me struggle to define useful function-types.
- October 25th, 2016: Today's #haskell exercise looks at counting values in an archive, then looks at the efficiency of that.
- October 24th, 2016: Today's #haskell exercise is to cluster (using k-means) the score cards we derived from daily top5s stock reports
- October 21th, 2016: Today's #haskell exercise transforms a transformation: we arrive at score cards from the daily top5s stock reports. Set of daily reports on the stock markets' top5s leaders and losers by category arrives at stock score cards.
- October 19th, 2016: We expand on yesterday's #haskell problem by counting all stocks in all categories of the top5s stocks data file. We find in today's #haskell solution there are a hella-lotta stocks (technical term) in each top5s category.
- October 17th, 2016: Today's #haskell exercise we look for top 5s stock patterns in the stock markets, because we're wizards, and stuff. Today's #haskell solution does a bit of frequency and adjacency analysis of stock prices, ... BUT WHAT DOES IT ALL MEAN?
- October 13th, 2016: Today's #haskell exercise looks at, well, ... an exercise log! Today's #haskell solution shows that Monoid + MultiMap == Love❤️And converted to KM for our Metricized friends.
- October 12th, 2016: Today's #Haskell exercise approaches the deepest philosophical questions with a blank slate ... I'll see myself out. Today's #haskell solution tabulates a rasa-t, mon. um ... I meant: today's blocks on the #blockchain as a table.
- October 11th, 2016: Today's exercise is to stitch together #haskell #blockchain web-services ... and to use the word 'Haskell-y'. Done.
- October 10th, 2016: What blocks/transactions occurred today on the #blockchain? We find those hash ids with today's #haskell exercise. For today's #haskell we get today's blocks from the #blockchain, despite a bit of bad-URL misdirection, even!
- October 6th, 2016: Today we make our #haskell web service more polished and a little more service-y AND incorporate the Merkle tree. Today's #haskell solution allows you to view a block's transactions and then choose a particular transactionto view.

- October 5th, 2016: For today's #haskell exercise we build a Merkle tree web-service! WOOT! Today's #haskell solution is a web service that fetches transactions of a block by hash. WOOT! WOOT!

- October 3rd, 2016: Today's #haskell exercise is a long postal-worker's sigh: we separate Merkle tree view-structure from the data-view. Today's #haskell solution shows that making Merkle Trees Foldable also helps in scanning the tree

## Saturday, October 22, 2016

### September 2016 1HaskellADay 1Liners Problems and Solutions

- September 15th, 2016:

Given [1..n], create an infinite list of lists [[1.. n], [n+1 ... n+n], [n+n+1 ... 3n], ...]

counting :: [Integer] -> [[Integer]] - joomy @cattheory

counting = (map . (+) . fromIntegral . length) >>= iterate - September 30th, 2016: The reverse of August's one-liner:

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

define f. Snaps for elegance.

Subscribe to:
Posts (Atom)