- 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
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.
Friday, April 13, 2018
February 2018 1 Liner 1HaskellADay Problems and Solutions
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
Subscribe to:
Posts (Atom)