Tuesday, October 3, 2017

September 2017 1HaskellADay 1Liner problems and solutions

  • September 26th, 2017:
    art2RawNames art = Raw (artId art) <$> (Map.lookup "Person" $ metadata art)
    curry away the 'art' var. ref: Y2017.M09.D26.Exercise 
  • September 19th, 2017:  The #1Liner to follow (next tweet) is a question based off a code snippet from Y2017.M09.D18.Solution. What is a better/more elegant definition?
    fmap (wordStrength . wc) (BL.readFile filename) >>= \dict ->
    return (Map.insert filename dict m)
    Reformulate. Curry the dict-ref.

Saturday, September 30, 2017

September 2017 1HaskellADay problems and solutions

Tuesday, September 19, 2017

August 2017 1HaskellADay 1Liners Problems and Solutions

  • August 1st, 2017:
  • f :: (Maybe a, b) -> Maybe (a, b) Define points-free.
  • August 1st, 2017:
    Given f above and f a and f b are mutually exclusive in Maybe monad, define
    g :: Maybe (a, b) -> Maybe (a, b) -> (Maybe a, b)
    points free
  • August 1st, 2017:
    Now, let's define the dual of f
    f' :: Maybe (a, b) -> (Maybe a, b)
    points free

Friday, September 1, 2017

August 2017 1HaskellADay problems and solutions

Tuesday, August 1, 2017

July 2017 1HaskellADay 1Liner

  • July 7th, 2017:
    In LU-decomposition of matrices you have square P-matrix:
    [[1,0..],
     [0,2,0..],
     [0,0,3,0..],
    ...]
    For matrices of n² size
    Code that
    • ∃! David Turner @DaveCTurner
      • matrix n = let td = take n . drop 1 in td [td $ replicate i 0 ++ [i] ++ repeat 0 | i <- [0..]]

Monday, July 31, 2017

July 2017 1HaskellADay Problems and Solutions

Friday, July 7, 2017

June 2017 1HaskellADay 1Liners

  • June 17th, 2017:
    f :: (a, [a]) -> [a] -> [a]
    f (c, w1) w2 = c:w1 ++ w2

    Define f points-free
    • bazzargh @bazzargh (++).uncurry(:)
      • Felt there must be a nicer way to exploit symmetry of mappend.uncurry(mappend.pure) but can't find it