- May 27th, 2018:
data F = F { a, b, c :: String }
data Stamped a = { time :: Day, stamped :: a }
f :: Stamped F -> String
output of f x is "time a b c" for the respective values of time, a, b, c
Is there some monadic / applicative elegant definition that does this? - Nickolay Kudasov @crazy_fizruk
f = intercalate “ “ . sequence [ show.time, a.stamped, b.stamped, c.stamped ] - Nickolay Kudasov @crazy_fizruk
f = intercalate " " <$> http://pure.show .time <> (sequence [a, b, c]).stamped
A bit trickier, but shorter and uses stamped once. - April 13th, 2018: given f :: [a] -> b -> [c]
where c is a derived from g :: a -> b -> c
You have [a] and [b]
Write a function h :: [a] -> [b] -> [c] from f
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.
Monday, February 18, 2019
April/May 2019 1HaskellADay 1Liners
January 2019 1HaskellADay Problems and Solutions
- January 30th, 2019: Wednesday's #haskell problem is to take the JSON-y articles and the HTML-encoded articles and sort them by id and by date.
- January 29th, 2019: For Tuesday's #haskell problem we convert JSON-like strings to valid HTML strings, handling irregularities (gracefully!) in the input data as we go. For Tuesday's #haskell solution we convert text to text when you're not sure of the structure a priori.
- January 28th, 2019: Hello, Haskellers! Happy New Year! Monday's #haskell problem is a little warming-up JSON parsing exercise to get back into the swing of things. Monday's #haskell solution uses the Data.Aeson library to parse the JSON into Haskell data structures.
Monday, January 28, 2019
December 2018 1HaskellADay Problems and Solutions
- December 19th, 2018: Tuesday's #haskell problem was to eliminate that pesky plus-sign; Wednesday's haskell problem is to enputify it back in! A solution of enputification.
- December 18th, 2018: Tuesday's #haskell problem is to sum a set of integers from file ... except the integers are stored with a novel representation. Tuesday's #haskell solution eliminates that pesky plus-sign, and, doing that, you get yourself a gold star from the adventofcode.com
- December 5th, 2018: Wednesday's #haskell problem: from KAYAK to ULULU, generalizing the palindrome-grid puzzle. Wednesday's #haskell solution: ULULU, RADAR, or any word you want can be engridified (that's a word, now)
- December 4th, 2018: Tuesday's #haskell problem is to find 5-letter palindromes in your word dictionary. Tuesday's #haskell solutions finds 'ULULU'! Now, that's another KAYAKescque word!
- December 3rd, 2018: Monday's #haskell problem is scanning a sea of A's, K's, and Y's for a KAYAK. Monday's #haskell solution is a kayak found, now that I remember where I placed it.
Monday, December 3, 2018
November 2018 1HaskellADay Problems and Solutions
- 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.
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!
Subscribe to:
Posts (Atom)