- 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.
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.
Saturday, October 22, 2016
September 2016 1HaskellADay 1Liners Problems and Solutions
Sunday, October 2, 2016
September 2016 1HaskellADay problems and solutions
- September 29th, 2016: Today's #haskell exercise looks at ways to get transactions from Merkle tree that DON'T involve a full-tree scan every time (given you do not know the transaction-hash, and you wish to search by user/address) #blockchain. Today's #Haskell solution transforms a Merkle tree of #bitcoin transactions into a MultiMap!
- September 28th, 2016: TOO MANY SINGLE-LEAF NODES! Today's #haskell problem improves the insert algorithm to minimize single-leaf nodes.
- September 27th, 2016: Today's #haskell exercise we discover a path through a Merkle tree to a hashed leaf node (a #blockchain transaction). For the #haskell solution we find #bitcoin transactions in a Merkle tree by hash
- September 26th, 2016: For today's #haskell problem we compare two Merkle Trees, one set the same, another set slightly different. And I hope this #haskell solution doesn't get carried away into Ackermann-territory! Merkle Tree node-difference.
- September 23rd, 2016: Today's #haskell exercise distills #bitcoin transactions, then represents them as relations. Today's #haskell solution views #bitcoin trades as graphs
- September 22nd, 2016: WHOA! WHOA! WHOA! Let's scale back the problem statement a bit, shall we? for today's #haskell exercise. Got the transactions and the addresses from the latestBlock on the #blockchain in #haskell
- September 19th, 2016: Today's #haskell problem we create our own Merkle tree from (faux) #bitcoin transactions and then visualize it! The #haskell solution uses real #bitcoin transactions to populate then visualize a Merkle Tree as a graph structure
- September 16th, 2016: Today's #haskell problem is sort of Sudoku with a BINOCULAR-twist! and what other unique 9-letter words do you know? This solution used generate-then-inline, totally avoiding testing with guards. Much faster AND correct!
- September 15th, 2016: Today's #haskell problem is neither soduko nor magic squares. And our solution was a generate-then-test with guards, can you do better?
- September 14th, 2016: For today's #haskell problem we study 'domino theory' ... eheh.
We took the brute-force approach to solve today's #haskell problem. Do you have a better approach?
- September 12th, 2016: Today's #haskell problem is a logic puzzle of infinities and infinitesimals … Not really, but it has a ring to it!
- September 9th, 2016: For today's #haskell problem with go on a little cryptoarithmetic-romp. And I got to use the word 'romp' in a tweet. A little bit of monadic combine; a little bit of
sortBy (compare `on` snd)
and we have our AFTER(SHOCK)ING #haskell solution - September 8th, 2016: Today's #haskell exercise asks you to create a (balanced) Merkle tree from block summaries from the #blockchain. We insert some blocks from the #blockchain to create a (balanced) Merkle tree for today's #haskell solution
- September 6th, 2016: For today's #haskell exercise we read in an entire block (with its transactions) of the #blockchain. You want all the transactions of a blockof the #blockchain? Today's #haskell solution gives them to you
- September 5th, 2016: For today's #haskell problem we begin to deconstruct blocks of the #blockchain by parsing block transactions. FromJSON instance definitions in #haskell allow us to parse transactions of blocks in the #blockchain
- September 2nd, 2016: Today's #haskell problem we look at reading in just one block of the #blockchain. Today's #haskell solution fetches the latest block from the #blockchain thanks to https://blockchain.info
- September 1st, 2016: Today's #haskell exercise gives us a rudimentarily-constructed Merkle Tree. Today's #haskell solution we create leaves and branches of Merkle trees (and a very simple tree sample) #bitcoin
Subscribe to:
Posts (Atom)