Thursday, February 11, 2016

January 2016 Haskell One-liners

  • January 26th, 2016: define line2Bio so that
    *Main> line2Bio "Birches by Robert Frost" ~> ("Birches","Robert Frost")
    (in 1 line)
    • Gautier DI FOLCO @gautier_difolco
      import Data.Bifunctor
      line2Bio = bimap unwords (unwords . tail) . break (== "by") . words
    • matthieu bulté @matthieubulte
      line2Bio = on bimap (unwords .) id tail . break (== "by") . words
  • January 26th, 2016: define swap points-free:
    swap :: (a,b) -> (b, a)
    • matthieu bulté @matthieubulte
      swap = uncurry (flip (,))
    • Noah Luck Easterly @walkstherain
      uncurry $ flip (,)
    • Андреев Кирилл @nonaem00
      import Control.Arrow
      swap = snd &&& fst

Thursday, February 4, 2016

Graphing with Goats

Slides, presented comme ça! Links at the end. Presentation posted on youtube of the meetup.



3 (I am known for teh kittehs)

4 (graphs-я-borin' is another talk I gave at SanFran GraphConnect 2015)

5. The Beach (not Plastic)



8. ACID means something very important to DBMSes(eses)(eses)

9. neo4j Graph of Amino Acids (data table, Haskell code)

(geddit? links to geddit?)

11. "sed-butt, sed-butt, sed-butt" my daughters chant around the house all day

Now: Graph-applications:

12. Social Media

13. The Markets

14. The Markets (again) / Managing Complexity

15. Search / (Fraud) Detection

16. Scoping / (Requirements) Analysis

17. Clustering

18. Errybody say: "YAAAAAAYYYYYY!"

19. Links, en-text-ified:

20. Buh-bay!

Monday, February 1, 2016

January 2016 1HaskellADay Problems and Solutions

  • January 29th, 2016: Yesterday we monaded, for today's #haskell problem, we COMonad! ... with STREAMS! Oh, yeah! onesies and twosies, duplicate to our solutionseis!
  • January 28th, 2016: Today: Monads. Tomorrow? COMonads! But today's #haskell problem: monads. Todayed we Monaded! Oh, yeah!
  • January 27th, 2016: Today's #haskell problem: A Date-client! Not what you're thinking, naughty children! *scold-scold*
  • January 26th, 2016: For today's #haskell problem we create a DayOfWeek web service! Woot!
  • January 25th, 2016: Per @SirElrik idea, this week we'll do #Haskell #µservices Today's problem is to JSONify a Day -> DayOfWeek function Date, JSONified
  • January 20th, 2016: Yesterday's problem showed us MLK-day was not a trading day, but WHAT WEEK DAY WAS IT? Today's #haskell problem: The solutioneth giveth us the dayth of the weeketh!
  • January 19th, 2016: Today's #haskell problem asks: Was yesterday a #trading day? And a #haskell solution to the trading calendar? Monoids, of course!
  • January 18th, 2016: Today's #haskell problem is a mathematical conundrum concerning poetry ... yes, poetry Langston Hughes and Rob't Frost give us the solution:
  • January 15th, 2016: Yesterday was the Repeatinator2000, for today's #haskell problem we have the GAPINATOR3004!! YES! Well, we see HALF the stocks are only mentioned once. But minGaps are NOT telling! Hm. 
  • January 14th, 2016: In the sea of data we look for some repeaters for today's #haskell problem AN (H)istogram? A HISTogram? eh, whatevs. #haskell soln shows LOTS of low frequency mentions
  • January 13th, 2016: One chart to rule them all, one chart to find them, one chart to bring them all, and in the darkness bind them Big Up Chart ... in #haskell, ya! 
  • January 12th, 2016: Printing out buy/sell Orders for further analysis The charts, ... with the #haskell program that generated them:

  • January 11th, 2016: Prolog. Lists. *drops mic For the solution we represent PrologList as a difference list
  • January 8th, 2016: '$NFLX and Chili?' is today's #haskell problem What is this fascination with eating chili whilst watching movies? Case study: $NFLX a solution with several buy/sell scenarios and some open questions remaining
  • January 5th, 2016: We are Y2K16-compliance officers for today's #haskell problem
  • January 4th, 2016: Happy New Year! Today's #haskell problem looks at the World of WarCr–... Oops, I mean the World of Work-flow!

Tuesday, January 5, 2016

December 2015 1HaskellADay 1-Liners

  • December 30th, 2015: You have a string of 'digits' in base whatever to convert to an Int
    debase :: [Int] -> Int -> Int
    debase [12,21,3] 26 ~> 8661
    Define debase
    • Gautier DI FOLCO @gautier_difolco
      import Data.Bifunctor
      debase = curry (sum . uncurry (zipWith (*)) . bimap reverse (flip iterate 1 . (*)))
    • bazzargh @bazzargh
      debase a b = sum $ zipWith (*) (reverse a) (map (b^) [0..])
    • obadz @obadzz
      or debase l b = foldl (\ p n -> p * b + n) 0 l
    • bazzargh @bazzargh
      that's better than mine. how about:
      flip (foldl1 . ((+) .) . (*))
  • December 12th, 2015: #math You have this sequence: [1,1,1,1,1,1,2,1,1,1,3,3] What is this pattern? Is there one? Write #haskell to generate this list.
  • December 3rd, 2015: Lens-y again Points-free-itize the following correctName :: Row -> Row correctName r = set lastName (init (view lastName r)) r
  • December 3rd, 2015: Let's get a little lens-y with this one: accumer :: Getter a t a -> t -> [a] -> [a] accumer f s acc = ans where ans = view f s:acc
    • Define the curried-accumer function that curries away the acc-argument.
    • What would the curried definition be if the function type were: accumer :: Getter a t a -> t -> Set a -> Set a
  • December 3rd, 2015: define minimax :: Ord eh => eh -> (eh, eh) -> (eh, eh) such that, e.g.: minimax 1 (2,3) ~> (1,3) minimax 10 (2,3) ~> (2,10)
    • Thomas Dietert @thomasdietert In that case, minimax n (x,y) = (minimum [n,x,y], maximum [n,x,y])
    • joomy @cattheory minimax = liftM2 (***) min max
  • December 1st, 2015: define (->>) :: (a -> m ()) -> (a -> m ()) -> a -> m () All monadic effects must be evaluated.
    • Jérôme @phollow (->>) f g a = f a >> g a 
      • then liftM2 (>>)
      • Nicoλas @BeRewt but the full applicative is: liftA2 (*>)

Monday, January 4, 2016

December 2015 1HaskellADay Problems and Solutions

December 2015

  • December 30th, 2015: For today's #haskell problem we convert valid airport IATA codes to ints and back And a Happy New Year solution: Safe travels should you be Haskelling by air!
  • December 28th, 2015: So, remember ADVENT? What happens when your INV becomes full? Today's #haskell problem looks at that
  • December 23rd, 2015: Warm and fuzzy December, so we have a warm and fuzzy #haskell problem for today
  • December 21st, 2015: For today's #haskell problem we are to deduce stock splits using LOGIC and SCIENCE
  • December 18th, 2015: Today's #haskell problem... 'may' be thematic with that 'Star ...' what was the name of that movie? Gosh! Star ... something! eh, whatevs: just let the Wookie win (always the best policy) 
  • December 17th, 2015: For today's #haskell problem we look at reporting out periodically on an investment and, BONUS! charting it! And we've charted our AAPL investment growth, too! 
  • December 16th, 2015: For (coming onto) today's #haskell problem we demask the masked data to unmaskify it, yo! And then the solution unmasked that masked data! (that's convenient.)
  • December 15th, 2015: So yesterday we masked some rows, but what happened to the masking dictionary? Today's #haskell problem we save it Ah! So that's where that cipher went!
  • December 14th, 2015: We look at a way of masking data for today's #haskell problem And the solution gives us some lovely masked rows
  • December 11th, 2015: Today's #haskell problem asks: WHAT DOES THE TRANSFORMED JSON SAY! (okay, that was weaksauce)
  • December 10th, 2015: For today's #Haskell problem we try to find relevancy in our daily lives ...well, in #JSON, which is the same thing.
  • December 9th, 2015: Today's #haskell problem asks you to read in some rows of #JSON We'll be looking into this data set through the week "Watcha readin'?" "JSON." "Cool! ... No, ... wait."
  • December 8th, 2015: My main man, magic Mike (m^5 to his friends) said: "You're doing it wrong."Do it right for today's #haskell problem A first stab at the solution, not taking into account splits, is posted at And the split-adjusted solution here: ~3700%-gain. It's time for me to sing the "You're the Top"-song to @MacNN_Mike
  • December 7th, 2015: In today's #haskell problem we cry «On y va!» and have at it! En garde, you pesky investment problem, you! The solution shows Dr. Evil does NOT get ONE MILLION DOLLARS! Nor piranhas with laser beams on their heads, either.
  • December 4th, 2015: We write a web-proxy to help out poor, little Ajax go cross domain for today's #haskell problem
  • December 3rd, 2015: We meet the Ip-man for today's #haskell problem. Hiya! Today's solution shares a little-known fact AND ALSO uses <$> as well! Is there a weekly limit on these thingies?
  • December 2nd, 2015: Synthetic data generation for today's #haskell problem NOT ONLY did we write a Synthetic data generator in a day but we learned all 50 states AND used <$> and <*> – BONUS!
  • December 1st, 2015: In today's #haskell problem, we see @geophf lose his cool. No... wait... That's not news now, is it. (RID analysis). Unwordin' down-low on the arrr-eye-dee, LIKE A GANGSTA!

Tuesday, December 1, 2015

November 2015 1HaskellADay One-liners

  • November 3rd, 2015:
Why is 'a' the standard label for type-variables? If you don't care what the type is, shouldn't the type be 'eh'? #imponderables
  • November 3rd, 2015:
{-# LANGUAGE OverloadedStrings #-}import Network.HTTPtype URL = StringrespBodyAsText :: URL -> IO Stringdefine respBodyAsTextrespBodyAsText url = simpleHTTP (getRequest url) >>= getResponseBody
  • November 2nd, 2015: 
You have f :: a -> IO b, g :: b -> IO (), h :: b -> IO AnsYou wish to sequence f, g, h as j :: a -> IO AnsDefine j points-freeDimitri Sabadie @phaazon_ fmap snd . runKleisli (Kleisli g &&& Kleisli h) . f

November 2015 1HaskellADay Problems and Solutions

November 2015

  • November 30th, 2015: Pride and Prejudice on the command-line? No. Today's #haskell problem: read in a stream The solution defines a new Kleisli arrow. ... AND Jane Austen prefers the pronouns SHE and HER. So there's that.
  • November 27th, 2015: Simply getting the command-line arguments for #BlackFriday #haskell problem ...and then there's that bonus. OH NOES! 'Simple' solution, am I right?
  • November 26th, 2015: A little worker-pool in #haskell wishes you Happy Thanksgiving from the #USA or today's problem: Erlangesque-Haskell And today, a #haskell solution says ('sez') "Go get'm Black Friday dealz, yo!" (but: caveat emptor!)
  • November 25th, 2015: Today's #haskell problem has a Secret Decoder Ring! ... as long as you use the HaHaJK-type. BREAKING: SHA1-HASH DECODED using #haskell! Reported here first show my bonnie lies over BOTH the ocean AND the sea!
  • November 24th, 2015: For today's #haskell problem we look at parsing URI ... not Andropov ... not today. Today's #haskell URI-parsing exercise makes Yuri (Andropov) SAD and MAD ... Don't worry, Yuri: URIs are just a FAD
  • November 23rd, 2015: For today's #haskell problem we ride West on ol' Silver declaiming: "JSON! Ho!" And the solution allows us to look at JSON and declaim: HA!
  • November 20th, 2015: Today's #haskell problem comes with honorable mentions and stuff! ♫ My!
    ... AAANNNNNDDDDD our solution, down to 4.6 seconds from 151 seconds. Not a bad start!
  • November 19th, 2015: In today's #haskell problem we say: '@geophf your RID-analyzer is SO efficient!' ... NOT! Update: today geophf cries Efficienc-me? No! Efficienc-you!
  • November 18th, 2015: Today JSON and the Argonauts sail off into the high seas of the RID to adventures beyond the Thunderdome! No...wait.
  • November 17th, 2015: Today's #haskell problem generates a report with no title... o! the irony! The solution shows Jane Austen getting her Aggro on ... even if just a little bit 
  • November 16th, 2015: New Regressive Imagery Dictionary/RID(-structure)? That means New-NEW JSON for today's #Haskell problem And there is the RID, in all its JSON-iferific glory!
  • November 13th, 2015: Today's #haskell problem–Project RIDenberg–classifies a big-ole document with FULL! ON! RID! (exclamation mandatory) Today's solution shows us that the RID is as fascinating as ... well: Mr. Wickham. (There. I said it.)
  • November 11th, 2015: Today's #haskell problem goes the Full Monty... NO! WAIT! NOT 'MONTY'! WE GO FULL RID! (Regressive Imagery Dictionary) ... annnnnndddd this #haskell solution gives us the full RID as a graph 
  • November 10th, 2015: For today's #haskell problem we look at parsing a (small) document and matching it to a (small) RID QWERTY-style! Our solution (also) answers that age-old nagging question: "What DOES the fox say?" … No, really: I need to know this.
  • November 9th, 2015: LAST week we looked at cataloguing the RID/Regressive Imagery Dictionary. Today's #haskell problem completes that. Not that every problem and every solution can be modeled as a Graph, but ... the solution-as-Graph is here: *blush
  • November 6th, 2015: Today's #haskell problem looks at the RID as Friends and Relations ... actually: it just looks at RID-as-relations Ooh! Pritty Bubblés for a solution to the RID-as-relations problem 
  • November 5th, 2015: Today's #haskell problem is to JSONify the RID because JSON, and because indentation as semantic-delimiters is weird A solution shows PRIMARY-RID-JSON in 420 lines, as opposed to the raw text at over 1800 lines. Cool story, bro!
  • November 4th, 2015: For today's #Haskell problem please Graph that RID! YEAH! I WANT YOUR SEX(y graph of the RID) poses a solution at
  • November 3rd, 2015: YESTERDAY we used a Python program to map a document to the RID in #Haskell TODAY we map part of the RID to #Haskell A solution gives us a Pathway to BACON, ... because priorities.
  • November 2nd, 2015: We look at EQ for today's #Haskell problem; not the Class Eq, but the Emotional Quotient of a document. Fun! runKleisli (from @phaazon_) and (>=>) to the rescue for the solution today