- 2021-01-28: Opposite problem:
You have: [(a, Set b)]
you want: [(a, b)]
e.g.: [("hi", fromList [1,2,3]), ("bye", fromList [4,6,7]) ->
[("hi",1),("hi",2),("hi",3),("bye",4),("bye",6),("bye",7)]
Interestingly, Set is not a Monad. wut. How do you get around that problem? - D Oisín Kidney @oisdk (>>= traverse toList)
- mine: concatMap (sequence . second Set.toList)
- 2021-01-28:
We have [(Set a, b)]
we want [(a, b)]
where each element of Set a is paired with b, e.g.:
[(fromList [1,2,3], 'a'), (fromList [4,5,6], 'b')]
becomes
[(1,'a'),(2,'a'),(3,'a'),(4,'b'),(5,'b'),(6,'b')] - Steve "wash your hands" Trout @strout:
concatMap (uncurry (liftA2 (,)) . bimap toList pure) - insatiable mask wearer @tim_1729
[(a,b) | (s,b) <- xs, a <- (toList s)] - Today, 2021/01/21, is:
- Can be written with only 3 digits, What other dates can be so written? Also:
- a day where the month and day are NOT amalgamation the year. But which dates are amalgamations?
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.
Thursday, January 21, 2021
January 2021 1HaskellADay 1Liners
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment