Sunday, July 31, 2016

July 2016 1HaskellADay Problems and Solutions

July 2016

Thursday, July 14, 2016

1HaskellADay 1Liners June 2016

  • June 13th, 2016:
    You want this list: [1, -1, 1, -1, ...]
    How would you produce this value in #Haskell ?
    • Wai Lee Chin Feman @wchinfeman
      (set plop to be identity, and set transformstate to be (*) -1)
    • Philipp Maier @AkiiZedd `iterate negate 1
    • Patrick Mylund @pmylund concat $ repeat [1, (-1)]
      • Gary Fixler @gfixler No need for the parens in a list.
    • Jeff Foster @fffej and Kevin Meredith @Gentmen
      iterate (* (- 1)) 1
    • Spencer Janssen @spencerjanssen and Андреев Кирилл @nonaem00
      cycle [1, -1]
      • Philipp Maier @AkiiZedd:
        I’m curious: Since concat is O(n) wouldn’t it take more and more time depending on how many items you take?
      • Patrick Mylund @pmylund Looks like they compile to the same thing
      • Philipp Maier @AkiiZedd I’m actually surprised the compiler can optimise this away :o Thanks for showing me ddump-simpl!
      • Eyal Lotem @EyalL concat is foldr (++), not foldl. O(1) work is done to produce the next item. [1,-1]++([1,-1]++(...
    • David Turner @DaveCTurner I'd actually write 'cycle [1,-1]' but I like the elegant, alliterative obscurity of   'iterate negate 1'
    • Fatih Karakurt @karakfa alt=1:[-x|x<-alt]

Friday, July 1, 2016

June 2016 1HaskellADay Problems and Solutions

  • June 29th, 2016: Today's #Haskell exercise is REALLY HARD! ... for Big Gov't. Can you solve it? A little bit of (well-typed) Prolog-like code gets us our #haskell solution for today 
  • June 28th, 2016: For today's #haskell problem we do ... NOTHING! But we are introduced to coding software for a huge bureaucracy  ... AAAAANNNDDD three System imports and we've got today's #haskell solution. Groovy! 
  • June 24th, 2016: #haskell problem today charts Stochastic Oscillators of a security  and includes a 'malus' problem: report generation 
  • June 23rd, 2016: Today we look at using #haskell to chart moving averages of a stock's prices 
  • June 21th, 2016: I pushed today's #haskell problem last night on git but did I announce it? sigh Complex roots of quadratic equations The #haskell solution gives us the Complex roots to any (Real) quadratic equation
  • June 20th, 2016: Solving quadratic equations is on the plate for today's #haskell exercise 
    It's not every day I code
    Thank you, #haskell, for today's solution to do so
  • June 17th, 2016: My, my! Where has the day flown? Today's #haskell problem is to reinvent charting API! ... or not.
  • June 16th, 2016: Today's #haskell exercise looks at representing $TWTR data as candlesticks 
  • June 15th, 2016: For today's #haskell problem, we round out the Data.Matrix module with the definition of the identity matrix There are many ways to define the identity matrix. Today's #haskell solution does so with Cellular Automata Rule 16
  • June 14th, 2016: Yesterday we computed the matrix determinant, today we'll invert a matrix and use it to solve systems of equations Today's #haskell solution inverts a matrix BECAUSE WE FEEL LIKE IT! Yeah
  • June 13th, 2016: For today's #haskell problem we *ahem* DETERMINE (eventually) to solve systems of equations The determinant is the sum of the products of the first row with the sub-matrix determinants, right? RIGHT!
  • June 10th, 2016: Today's #haskell problem looks at box-and-whiskers charting of data Boxes for realz, yo: The #haskell solution has @geophf writing 'uncurry uncurry' and sincerely meaning it! 😱 and box: 
  • June 9th, 2016: Triangles are on my mind for today's #haskell problem: … bisecting them, then trisecting them.
  • June 8th, 2016: For today's #haskell problem, just what you've always wanted: MATH HOMEWORK! We find the intersection of two lines
  • ANNOUNCEMENT: is acting up; cloning original @1HaskellADay github repository and putting the exercise there. FYI
  • June 6th, 2016: Today's #haskell problem explores superstring theory No, it doesn't, but saying that has a certain ring to it!
  • June 3rd, 2016: We saw a solution to perfect matching yesterday. For today's #haskell problem, let's efficient-ize it!
  • June 1st, 2016: Today's #haskell problem is pretty much counting complements ... pretty much. These apparently simple problems are actually rather hard. Today we have a #P-complete #haskell solution