- November 27th, 2018: Tuesday brings a little more logic to today's #haskell puzzler.
- November 26th, 2018: Monday's #haskell problem: J'ACCUSE!
- November 23rd, 2018: A little late, but here's a little logic puzzle to solve using #haskell on a frigid Friday. That took a couple of iterations, but BOOM! a #haskell solution to Friday's little logic puzzle.
- November 22nd, 2018: Thursday's #haskell problem is from @fermatslibrary: we throw enough 1/4th together and we get 1/3. Trust me on this one.
- November 21st, 2018: From @fermatslibrary comes Wednesday's #haskell problem For Wednesday's #haskell solution: π and e as an equality? How transcendent! ... eheh. 😎
- November 5th, 2018: Monday's #haskell problem: rectangular numbers from a calculator face are all divisible by 11. True? The #haskell solution shows that yes, it is true!
- November 2nd, 2018: From @fermatslibrary comes Friday's #haskell problem: twoSquaresDifference of any odd number. Friday's #haskell solution we are folding odd numbers to find their diff squares.
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.
Monday, December 3, 2018
November 2018 1HaskellADay Problems and Solutions
Friday, November 2, 2018
October 2018 1HaskellADay Problems and Solutions
- October 31st, 2018: A Happy Halloween arithmetic puzzle for you Happy Haskellers!
- October 25th, 2018: Thursday's #haskell problem we have a (Loopful) compiler for BF* Thursday's #haskell solution: A BF* compiler, blocks of code in loops working.
- October 24th, 2018: Wednesday's #haskell problem: Thus we enter the Turing Tarpit! The solution to Wednesday's #haskell problem is a BF* (loopless) interpreter that prints out "Hello, world!" I didn't think I could reach the pinnacle of programming in my lifetime, yet, here I am. 😎
- October 19th, 2018: For Friday's #haskell problem we look at patterns in how people define categories: a little knowledge management.
- October 17th, 2018: For Wednesday's #haskell problem we are using Haskell to automate writing a set of SQL INSERT statements. The function addDays to Wednesday's #haskell problem's rescue!
- October 15th, 2018: Monday's #haskell problem is a little asset shell-game. A little Set.union, a little Set.difference, to get today's #haskell solution.
- October 9th, 2018: Tuesday's #haskell problem: given a set of ids and our knowledge store from yesterday, determine the status of the new ids. Tuesday's #haskell solution: a Set to determine membership, and a Map to give the result, with a little bit of Frege-logic for fun!
- October 8th, 2018: Monday's #haskell problem is random screening (okay: predetermined screening). Monday's #haskell solution: indexing into a list often? Consider the Array-type.
- October 5th, 2018: Friday's #haskell problem we create a workflow to process chunks of files as SQL INSERT statements. And lo! and behold! A #haskell solution to all our problems... or today's problem, anyway.
Friday, October 5, 2018
August 2018 1HaskellADay problems and solutions
- August 22nd, 2018: For Wednesday's #haskell problem we query a directory and massage some JSON: all in a day's work. Wednesday's #haskell solution: Processing JSONs ... LIKE A BOSS!
- August 20th, 2018: For Monday's #haskell problem we distill UUIDs encoded in news media URLs. Monday's #haskell solution uses the break function FTW!
- August 16th, 2018: For Thursday's #haskell problem we have Zipf's Law and words-in-sentences: a [The Current Year] analysis.
- August 15th, 2018: For Wednesday's #haskell problem, we look at the 5000 most frequently used English words and do a bit of analysis. Wednesday's #haskell solution gets us the top 5000 English language words and their counts.
- August 3rd, 2018: For Friday's #haskell problem we ingest JSON to discover its structure.
Thursday, August 2, 2018
July 2018 1HaskellADay Problems and Solutions
- July 31st, 2018: Tuesday's #haskell problem: let's start to build a #kakuro-solver! YES! (Image via http://www.menneske.no/kakuro)
- July 30th, 2018: For Monday's #haskell problem we are looking at merging databases. Monday's #haskell solution is a Set.intersection, and we see the shared data tables of the two databases.
- July 24th, 2018: For Tuesday's #haskell problem we are discovering a JSON dictionary structure and pruning away non-entries. A little JSON dictionary exploration with #haskell gets us to our solution today.
- July 17th, 2018: For Tuesday's #haskell problem we parse bits o' data from more extensive JSON.
- July 11th, 2018: Wednesday's #haskell problem is going from an 'iffy' JSON structure to PERFECT (well: less 'iffy') JSON structure.
- July 10th, 2018: For Tuesday's #haskell problem we explore and structure illtempered JSON. When JSON looks normal, but it's not quite, you call ... AESON on wings of eagles for Tuesday's #haskell solution.
- July 9th, 2018: In Monday's #haskell problem we discover structure in mondo JSON. Monday's #Haskell solution revealed itself in the first 300 characters of prettiness!
- July 3rd, 2018: For Tuesday's #haskell problem we translate the graph-like JSON to a set of relations, viewable in a graph database. For Tuesday, #haskell's graph-solution using Relation values and, ooh! pretteh pictures!
Tuesday, July 3, 2018
June 2018 1HaskellADay Problems and Solutions
- June 29th, 2018: Friday's #haskell problem is partially parsing a very large file. For Friday's #haskell solution we parse a JSON map by hand.
- June 27th, 2018: In Wednesday's #haskell problem, we parse JSON ... TWICE! to get to the underlying graph structure. Wednesday's #haskell solution is a little bit (a lot, actually) of JSON parsing, and then some graph analysis.
- June 26th, 2018: Tuesday #haskell problem converts a .properties file to JSON to make a REST call. Converting a .properties file to JSON in 23,952 easy steps for Tuesday's #haskell solution.
- June 25th, 2018: Monday's #haskell problem is parsing a JSON error report and updating the JSON with new information. In Monday's #haskell solution, we get a little 'lens-y' to update JSON data.
- June 22nd, 2018: Friday's #haskell problem sends articles-as-JSON to an AWS Lambda function for processing.
- June 20th, 2018: Wednesday's #haskell problem is SymbolTable from a set of articles, then document vectors.
- June 19th, 2018: We find out that 'materially' is the word for Tuesday's #haskell problem. For Tuesday's #haskell solution we find that parsing JSON is simpler than parsing TSV. This comes as a surprise to no one but me.
- June 18th, 2018: Monday's #haskell problem asks: "When are unique IDs not unique IDs?" More dater-analyses. Monday's #haskell solution: we go from 2300+ duplicates to 30+ duplicates. A good day's work.
- June 15th, 2018: Friday's #haskell problem is sorting and removing duplicatesfrom a data table by defining Ord. Friday's #haskell solution removes duplicate articles by ID... but are the articles duplicates? Hmmmm!
- June 8th, 2018: "Dater-analytics" is the name of the game for Friday's #haskell problem. You get some real-world dater that's yucky, and you get to unyuckify it. You're welcome.
- June 6th, 2018: Now we take that restructured JSON (see yesterday's exercise) and store that JSON in a PostgreSQL database for Wednesday's #haskell exercise. Wednesday's #haskell solution populates entities with wikipedia reference into a PostgreSQL database.
- June 5th, 2018: Tuesday's #haskell problem is to transform 'pancake' JSON into ... '3-layer cake'-JSON? Sure. #nailedit Tuesday's #haskell solution we restructured JSON and saved result to ... JSON! YAY!
- June 4th, 2018: Monday's #haskell problem: interlanguage communication via the function main. 3 + 4 = 7 ... now do that and have Python talking to Haskell.
Monday, June 4, 2018
May 2018 1HaskellADay Problems and Solutions
- May 31st, 2018: In Thursday's #haskell problem we are analyzing JSON so we can produce ... MORE JSON! And thus grows our Big Data. Thursday's #haskell solution shows us the results of Big Data analytics? More Big Data. YES!
- May 30th, 2018: Wednesday's #haskell problem we process 'big-ish' data. Wednesday's #haskell solution: You take your big(-ish) data, and you chart it. THIS WE CALL DATA SCIENCE!
- May 25th, 2018: Friday's #haskell problem is load testing a web application with a database pull. Friday's #haskell solution: a load-tester in Haskell! AHA! 😎
- May 24th, 2018: Thursday's #haskell exercise is adding articles to be cleaned up, post-ETL, to a dirty table in PostgreSQL. Thursday's #haskell solution stages articles loaded into the database to be cleaned up later.
- May 21st, 2018: Monday's #haskell problem is to insert NEW (triaged) articles into a PostgreSQL database.
- May 18th, 2018: Friday's #haskell exercise: there seems to be a lot of tagged terms for articles. Download these terms-as-JSON from a REST endpoint and count them is today's exercise. Friday's #haskell solution has got me singing "Havana-na-na-na!" ... no, wait: I meant: "uploading tags from a REST endpoint to a PostgreSQL database." That's what I meant.
- May 17th, 2018: Thursday's #haskell exercise is to add database update functionality to existing code and in a Writer/IO monad; yikes! Thursday's #haskell solution: from the triaged articles, the update SQL statements naturally fall out.
- May 11th, 2018: Friday's #haskell exercise: bridging Python and Haskell to deliver a polyglot system.
- May 8th, 2018: Tuesday's #haskell problem uses articles fetched from a REST endpoint and article metadata to triage articles for daily upload to a PostgreSQL database. Tuesday's #haskell solution... triage: get!
- May 7th, 2018: Monday's #haskell problem is extracting metadata for articles stored in a PostgreSQL database. Monday's #haskell solution repurposes a library to fetch article metadata from a new article database.
- May 4th, 2018: For Friday's #haskell problem we look at a daily upload process from a REST endpoint to a SQL data store and start to implement it. Friday's #haskell solution gets a week's worth of data from the REST endpoint.
Thursday, May 3, 2018
April 2018 1HaskellADay Problems and Solutions
- April 25th, 2018: For Wednesday's #haskell problem we prove, definitively, @fermatslibrary n^5 is n ... for very small n. For Wednesday's #haskell solution we learn that number theory is so cool!
- April 24th, 2018: For Tuesday's #haskell problem we look for a fix-point of simplifying HTML. Good thing it's not NP-hard! ... no ... wait. Tuesday's #haskell solution is the fix-point for HTML. Just like the fix-point for factorial. Structurally, maybe, but otherwise, kinda not.
- April 23rd, 2018: What happens when things go wrong? We start to look at debugging for Monday's #haskell problem. For Monday's #haskell solution: the error is not here; the error is in another castle.
- April 20th, 2018: Friday's #haskell problem is to decode HTML entities from titles of articles. Friday's #haskell solution: deHTMLification: get
- April 18th, 2018: Hey! Let's store the raw JSON as a fall-back should our ETL process fail for Wednesday's #haskell problem. Wednesday's #Haskell solution: storing raw JSON in a SQL data store BECAUSE WE CAN!
- April 17th, 2018: For Tuesday's #haskell problem we upload articles from a different publisher of a compressed JSON archive with a different format. We find adding a differently-structured set of articles to IxArt store is simple for Tuesday's #haskell solution.
- April 16th, 2018: For Monday's #haskell problem, we take articles-as-json from various sources and put them into a common SQL data store. For Monday's #haskell solution we upload articles from different publications to a common SQL data store, both compressed and uncompressed archives.
- April 13th, 2018: Friday's #haskell problem is to grab packets of articles from a REST endpoint for later processing. Friday's #haskell solution: Those are some rather large packets downloaded from the REST endpoint!
- April 12th, 2018: Thursday's #haskell problem: auditing and logs. Thursday's #haskell solution is to wrap packet extraction and insertion in an ETL process.
- April 11th, 2018: Wednesday's #haskell problem: when we download packets of articles, let's record that event. Wednesday's #haskell solution: we're inserting packets into our new database.
- April 10th, 2018: Tuesday's #haskell problem: 🎵 "Does anybody know what time it is?" 🎶 (bonus: name that tune) Tuesday's #haskell solution: "Hey, Mister! You got the time?"
- April 9th, 2018: Monday's #haskell problem is to extract article tags from JSON then store them in a PostgreSQL lookup table. Monday's #haskell solution: Inserting tags for articles into a PostgreSQL database is a breeze!
- April 6th, 2018: Friday's #haskell problem is to parse categories-as-JSON, strip it down to its essentials, and store in a PostgreSQL data table. Friday's #haskell solution uploaded categories to a PostgreSQL databse after 'removing the stupid.' That's a technical term.
- April 5th, 2018: Thursday's #haskell problem is revising the database connector now that we're managing multiple databasen. Thursday #haskell solution is making connections to SQL databases configurable. Whoa. Edgy, tweeps! I'm really pressing the bleeding edge of technological advancement here with configurations and database connections.
- April 4th, 2018: Wednesday's #haskell problem is storing authors in a PostgreSQL table. Wednesday's #haskell solution shows that transferring authors from articles to a SQL database is as easy as 1, 2, 3!
- April 3rd, 2018: Tuesday's #haskell exercise: AUTHOR! AUTHOR! Is there an author in the house? Tuesday's #haskell solution: extracting author information from very unstructured data.
- April 2nd, 2018: Monday's #haskell problem is to explore JSON to find the structure in the data. Monday's #haskell solution: oooh! Pritteh JSON! But what's this weirdness with the author-identifier?
Friday, April 13, 2018
February 2018 1 Liner 1HaskellADay Problems and Solutions
- February 8th, 2018: We have maybe :: b -> (a -> b) -> Maybe a -> b. But we don't have list? Or do we? Define list:
list :: b -> ([a] -> b) -> [a] -> b
list nullanswer flist lst = undefined - BONUS: Both Maybe a and [a] are binary types, ... so is MonadPlus:
Maybe a = Nothing | Just a
List a = Cons a (List a) | Nil
MonadPlus m => mzero | m a `mplus` m a
Is there some generalization that maybe and list are functions of? What is that generalization? - February 6th, 2018:
You have f :: a -> [b] -> [c]
But instead of just one a you have [a]
Define g :: [a] -> [b] -> [c]
in terms of f - Daniel @leptonyu g as bs = foldl (\xs a -> f a bs ++ xs) [] as
- ptdr_bot @m0rth0n g as bs = flip f bs =<< as
- Victoria C @ToriconPrime g as bs = concat $ fmap ($ bs) (fmap f as)
- matt @themattchan g = flip $ concatMap . flip f
- Nicoλas @BeRewt g = flip (flip (>>=) . flip f) Or: g as bs = as >>= flip f bs
- Sangeet Kar @sangeet_kar g = foldMap f
Monday, April 2, 2018
March 2018 1HaskellADay problems and solutions
- March 14th, 2018: Wednesday #haskell problem I am thinking about sumaSumasCuadradosDivisores from the Haskell community via @Jose_A_Alonso
- March 12th, 2018: Monday's #haskell problem is Improving Tarski's logic language with curried functions.
- March 8th, 2018: For Thursday's #haskell problem, thanks to @wtfunctional, we'll play with Other People's Code! ... and Mandelbrot sets.
- March 6th, 2018: Tuesday's #haskell exercise asks the eternal question: "Are you my mom?"... and also looks at curried functions in a logic framework... which is nice. Last Tuesday's #haskell solution ended in pathos: I know 'momOf', but I cannot answer, 'are you my mom?' Can you not feel the sads?
- March 5th, 2018: Monday's #haskell problem is a little "Introduction to Logic" by Tarski to start our week of right. I went a little 'forall' in the #haskell solution today. Sorry. #notsorry
Thursday, March 1, 2018
February 2018 1HaskellADay problems and solutions
- February 28th, 2018: Wednesday's #haskell problem: (sung:) Ya know that I love Casey's Mom! (guitar wails) Wednesday's #haskell solution we solve with LOGIC PROGRAMMING! ... IN HASKELL! YES!
- February 27th, 2018: Tuesday's #haskell problem: A job scheduling problem, posed by Mensa, answered by Haskell. Tuesday's #haskell solution is this lcm/scan-like function, because "... the work is never done."
- February 22nd, 2018: Thursday's #haskell problem is counting in Haskell IN YOUR NATIVE LANGUAGE!
- February 21st, 2018: Wednesday's #haskell problem is sorting lists and making list-o-lists from lists, via P99 and random.org because my love-affair with #Prolog. *ahem* (pure) Prolog. Wednesday's #haskell solution: lsort and lfsort, provided to you by sortOn and by @bazzargh and @xgrommx
- February 20th, 2018: Tuesday's #haskell problem: More fun with elements in a list! Whee! Tuesday's #haskell solution: the monad-y approach, with alternatives by @xgrommx @bazzargh @johannesweiss
- February 19th, 2018: Monday's #haskell exercise is from @fermatslibrary: permutable primes. Monday's #haskell solution: Primes. Permutable. ... #PWND!
- February 16th, 2018: For Friday's #haskell problem P99 Prolog problem 33, coprime numbers with an assist by random.org. Friday's #haskell solution is coprimes: as easy as you please!
- February 15th, 2018: Thursday's #haskell problem is the greatest common denominator via P99 Prolog problem set. For today's #haskell solution I'VE JUST (re)INVENTED GCD! KNEEL BEFORE ZOD!
- February 14th, 2018: For Wednesday's #haskell problem: "I'm thinking of a word that has the letter 'V' ..." Happy Valentine's Day ... as an anagram! Today's #haskell solution was defined with ALACRITY! YUS!
- February 13th, 2018: Tuesday's #haskell problem: we have unicode, and we could parse that as Text, but why do that when they want plain, old ASCII? ... why, indeed! Removing non-ASCII characters from documents is one approach to parsing them...
- February 12th, 2018: A little CSV to JSON work via #haskell today. Monday's #haskell solution: 🎵 You say CSV, I say JSON. Let's call the whole thing off! 🎵
- February 9th, 2018: Logs get stale, quickly! Let's archive old log entries for Friday's #haskell problem... so quickly, in fact, that the Friday's #haskell solution archived 270k+ rows of log entries!
- February 7th, 2018: So, we will update articles in our PostgreSQL data store, but what happens when your codec is LATIN1 and you need to store the article as UTF8? Wednesday's #haskell problem. Wednesday's #haskell solution: TFW the exercise is an update function, but the solution goes whole-hog! smh 🙄
- February 6th, 2018: Tuesday's #haskell problem is timestamping packets and associating articles with the packets that downloaded them. Tuesday's #haskell solution: associating the articles we uploaded TODAY with the packet we uploaded TODAY!
- February 5th, 2018: On #SuperBowlSunday I release Monday's #haskell problem which is to timestamp log entries, because that's what we live for. Today's #haskell solution was a stunning victory by the Philadelphia Eagles ... no, ... wait: it was log entries, timestamped. There. #nailedit
- February 2nd, 2018: We've downloaded a the most recent set of articles from a REST endpoint; now we have to exclude Associated Press articles from our local paper's set. Friday's #haskell problem. Today's #haskell solution filters out Associated Press articles from out downloaded article-set.
- February 1st, 2018: Thursday's #haskell problem is from a picture posted from @fermatslibrary: anagrams as prime-multiples. Teacher: Class the following words are all English words: "Elaps lapse Lepas Pales salep saple sepal slape spale speal" Class: ... <<- a="" haskell="" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN14nLdE2N0f2Zonc4xiXS9QwTY6ZiCvibeBzWRFL3szla11GYssWss4Isip5EOAyig2nAGzc8T2JSUP2iEC3AJbfknerzXflXeO_Y9CSfweII2Wwb_PXNxSoAcBXMZvqhWB7FFREgKsYT/s1600/anagram-by-primes.jpg" imageanchor="1" no="" s="" solution.="" style="color: #7d181e; margin-left: 1em; margin-right: 1em; text-decoration: none;" words.="" yesterday="">->
Tuesday, February 6, 2018
January 2018 1Liner 1HaskellADay problems and solutions
- January 8th, 2018: from Nicoλas @BeRewt
A small @1HaskellADay, old-school. Define foo:
> foo 3 [1..5]
[([1,2,3], 4), ([2,3,4], 5)]
> foo 2 [1..4]
[([1,2], 3), ([2,3], 4)]
> foo 2 [1..20]
[([1,2],3), ([2,3],4), ..., ([18,19],20)]
> foo 20 [1..2]
[] - Demiurge With a Teletype @mrkgrnao
foo n
= tails
# filter (length # (> n))
# map (splitAt n # second head)
(#) = flip (.) - Andreas Källberg @Anka213
I haven't tested it, but this should work:
foo n xs = [ (hd,x) | (hd , x:_) <- n="" splitat=""> tails xs ]-> - <- n="" splitat="">Nicoλas @BeRewt foo n = zip <$> fmap (take n) . tails <*> drop n->
- January 5th, 2018: You have the following DAG-paths:
a -> b -> c -> e
a -> b -> d -> e
q -> r -> s
w -> x
y -> z
and many more.
From a path, provide a bi-directional encoding* given maximum graph depth is, say, 7, max number of roots is, say, 10, and max number of nodes is, say, 1000. - *bi-directional encoding of a graph path:
DAG path -> enc is unique for an unique DAG path
enc -> DAG path yields the same DAG path that created the unique enc.
*DAG: "Directed, acyclic graph." - January 5th, 2018: given s :: Ord k => a -> (k,[v])
define f using s
f :: Ord k => [a] -> Map k [v]
with no duplicate k in [a] - Christian Bay @the_greenbourne f = foldr (\e acc -> uncurry M.insert (s e) acc) M.empty
- me: you can curry away the acc variable easily
- Christian Bay @the_greenbourne You're right :)
f = foldr (uncurry M.insert . s) M.empty - Bazzargh @bazzargh fromList.(map s) ?
- me: Yuppers
Wednesday, January 31, 2018
January 2018 1HaskellADay Problems and Solutions
- January 30th, 2018: For Tuesday's #haskell problem we look at triaging articles downloaded from a REST endpoint against our PostgreSQL database. Who knew putting things into three bins could be so much fun? Today's #haskell solution triages work for us.
- January 29th, 2018: Monday's #haskell problem is to fetch when the last set of articles were stored; two approaches. Monday's #haskell solution: two approaches to extract 'last entry' from the database, wanted; two approaches to extract 'last entry' from the database, GOT!
- January 26th, 2018: Friday's #haskell problem is to pull a week's worth of data from a REST endpoint when we don't know a priori how many calls we have to make. Friday's #haskell solution fetches then reads/parses blocks of articles from a REST endpoint.
- January 24th, 2018: Wednesday's #haskell problem is solving three more #Prolog-y list problems from P99: pack / encode / decode. It's great when #haskell has grouping / 'un'grouping functions in the library already.
- January 23rd, 2018: Tuesday's #haskell problem: groups and grouper ... I like grouper blackened, please! Solving today's #haskell problem with Qubits?!? Nah, not really, but that would be cool if we did!
- January 22nd, 2018: Monday's #haskell problem is a problem from P99: problem P21, list insertion. Monday's #haskell solution is inserting an element into a list, PROLOG-STYLE!
- January 18th, 2018: The whole enchilada! Today's #haskell problem ties it all together to make an ETL. Today's #haskell solution defines etl: Looping over calls to the REST endpoint then database insertions.
- January 17th, 2018: For today's #haskell problem we use PostgreSQL data store and Haskell to pick up where we left off on an application run. Today's #haskell solution: the audit log has what our program last did, so now we know what we'll work on next!
- January 16th, 2018: Where did yesterday's Haskell problem go? Here it is! Today's #haskell problem: read a packet from a REST endpoint. Today's #haskell solution accesses a REST endpoint with a set timeout and with the default timeout.
- January 15th, 2018: "Logging? Why do we have to log stuff?" Enterprise applications require audit trails. Today's #haskell problem provides one. What did your Haskell app do and when? Today's #haskell solution: an audit log.
- January 11th, 2018: Thursday's #haskell problem: pulling SQL lookup tables into Haskell. Thursday's #haskell solution: with the help of IxValues we extract lookup table values from SQL into Haskell Maps.
- January 10th, 2018: Wednesday's #haskell exercise is to store the packet information into the PostgreSQL database as a part of auditing the ETL process. Wednesday's #haskell solution stores the packets that wrap article sets then logs our results.
- January 9th, 2018: Tuesday's #haskell problem we are logging log messages to the log data table. YES! Tuesday's #haskell solution: logging in the style of log4j.
- January 8th, 2018: Monday's #haskell problem: once more into the breach, and thoughts on generalization – storing unique newspaper article sections in PostgreSQL. We store article section information, then we build a function that stores ANYTHING! ... and washes windows, TOO! *
*YMMV additionaltermsandconditionsmayapplydependingonyourregion - January 5th, 2018: Friday's #haskell problem takes a break from SQL Databases and Haskell and does something completely different: data schemes and Haskell. AHA! Friday's #haskell solution is a graph-view of the sections for a sample of 100 articles.
- January 4th, 2018: Thursday's #haskell problem looks at storing in PostgreSQL authors of periodic articles uniquely identified by uuid. Thursday #haskell solution uses etl function with generators to store parsed authors in PostgreSQL database.
- January 3rd, 2018: Wednesday's #haskell problem is in honor of Baron Munchausen and his fantastic adventures!
- January 2nd, 2018: WELCOME TO THE NEW YEAR, HASKELLERS!
Tuesday's #haskell problem leverages keywords-as-subjects and makes storing article keywords into PostgreSQL easier... we hope. Tuesday's #haskell solution Incorporates prior work with memoizing tables and subjects with results.
Friday, January 5, 2018
December 2017 1HaskellADay 1Liners problems and solutions
- December 29th, 2017:
given f :: Monad m => n -> a -> m (Maybe b)
define g :: Monad m => n -> a -> m (a, Maybe b)
using f and ... arrows? Kleisli category? - Bazzargh @bazzargh (\n a->liftM ((,) a) (f n a)) ... according to pointfree.io, that's `liftM2 fmap (,) . f` but I can't pretend to get the transformation
- December 29th, 2017:
given f :: a -> b
define g :: [a] -> [Maybe c] -> [(b, c)]
>>> g [1,2,3] [Just 7, Nothing, Just 10]
[("1",7),("3",10)]
when f = show - matt @themattchan
g = catMaybes ... zipWith (fmap . (,) . f)
where (...) = (.).(.) - garrison @GarrisonLJ g a b = map (f.id***fromJust) . filter (isJust . snd) $ zip a b
- TJ Takei @karoyakani g = (catMaybes .) . zipWith ((<$>) . (,) . f)
- December 29th, 2017: define f :: [(a,b)] -> ([a], [b])
- Андреев Кирилл @nonaem00 and matt @themattchan unzip
- Victoria C @ToriconPrime f = fmap fst &&& fmap snd
- (in a vacuum, a more general type signature would be inferred, but the compiler limits itself as instruct)
Tuesday, January 2, 2018
December 2017 1HaskellADay problems and solutions
- December 29th, 2017: In Friday's #haskell problem we leave 2017 with a filter and a BANG! ... BANG! Today's #haskell solution we weave logging into the ETL article upload process.
- December 28th, 2017: Thursday's #haskell problem is late AND a quicky: fetch a row of JSON from the database and pretty-print it. Thursday's #haskell solution had me leap from the bath tub and shout EUREKA! as I saw the issue in the JSON.
- December 27th, 2017: In Wednesday's #haskell problem we learn that when you parse dates for your articles, you don't need to carbon-date it anymore. In the solution to yesterday's #haskell problem, we encounter and report some parsing issues around optionality.
- December 26th, 2017: Tuesday's #haskell problem: scan an article archive, store an article archive; databases are neat that way. Today's #haskell solution: storing articles-as-JSON into a PostgreSQL database? No problem!
- December 22nd, 2017: Friday's #haskell exercise we do our first bit of parsing with the help of tagsoup. Okay, this #haskell Aeson / TagSoup stuff is awesome for parsing JSON / HTML stuff.
- December 20th, 2017: Wednesday's #haskell exercise. We take a large-ish JSON article archive, scan it, and spit out* a smaller-...ish JSON article archive. *'spit out' is a technical term. Today's #haskell solution provides a subset of the JSON article archive printed prettily.
- December 18th, 2017: Monday's #haskell problem: Friday you submitted an oembed request for goats, today you create a JSON oembed response service. Today's #haskell solution brings you a goat oembed service, serve with PHP.
- December 15th, 2017: Today we build a goat oembed request. I kid you not! geddit? GEDDIT? Today's #haskell solution: OEmbed Goats requests, want? OEmbed Goats requests, GOT!
- December 14th, 2017: Thursday's #haskell problem we sing 🎵 ... EVERYBODY'S WORKIN' FOR THE WEEKEND! 🎶 So, 18 composeable dates on the weekends. I'm freeing up my calendar, then!
- December 13th, 2017: Wednesday's #haskell problem is a hot date! WOOT! Today's #haskell solution has 66 composable dates in 2017. Cool!
- December 12th, 2017: Tuesday's #haskell problem is batching a SQL queryinstead of making multiple queries. It is so much faster! Today's #haskell solution has another LEFT JOIN in the SQL query to consolidate data gathering.
- December 11th, 2017: Monday's #haskell problem is computing and storing exponential distribution values. The exponential distribution: today's #haskell solution shows it's really simple.
- December 8th, 2017: For Friday's #haskell problem we parse NYT article summaries and upload them to a PostgreSQL database. Today's #haskell solution shows that our simple parsing exercise wasn't so simple. Isn't dirty data delightful?
- December 7th, 2017: Throwing the switch with Thursday's #haskell with a hard reset of the database. For today's #haskell solution we do a hard reset: we wipe the recommendation and publish tables and repopulate.
- December 6th, 2017: It's 'kinda' bad to return articles from a search that are already recommended. Wednesday's #haskell problem fixes this. Today's #haskell solution shows what a simple filter notMember can do.
- December 5th, 2017: Tuesday's #haskell problem we narrow our focus and structure our keyword search-space only on keys requested in the NYT archive on PostgreSQL. With a little bit of monadic/applicative magic, we have narrowed keyword searches.
- December 4th, 2017: For Monday's #haskell problem: "But can Haskell do anything useful?" Two words: ... yes.
- December 1st, 2017: For Friday's #haskell problem, what happens when the boss says: "That's good, but ..."? REWORK! THAT's what happens! Today's #haskell solution renders the source article in full and the recommended articles in brief. Got it!
Subscribe to:
Posts (Atom)