- 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 https://gist.github.com/patrickmn/9a92ab2a088018b2c0631f3bcfd60ebe
- Philipp Maier @AkiiZedd I’m actually surprised the compiler can optimise this away :o Thanks for showing me
- Eyal Lotem @EyalL
foldr (++), not
foldl. O(1) work is done to produce the next item.
- Philipp Maier @AkiiZedd:
- Wai Lee Chin Feman @wchinfeman
- David Turner @DaveCTurner I'd actually write '
cycle [1,-1]' but I like the elegant, alliterative obscurity of '
iterate negate 1'
- Fatih Karakurt @karakfa
Thursday, July 14, 2016
Friday, July 1, 2016
- 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 https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D23/Exercise.hs https://twitter.com/logicalgraphs/status/743409829843243008
- June 21th, 2016: I pushed today's #haskell problem last night on git but did I announce it? sigh Complex roots of quadratic equations https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D21/Exercise.hs The #haskell solution gives us the Complex roots to any (Real) quadratic equation https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D21/Solution.hs
- June 20th, 2016: Solving quadratic equations is on the plate for today's #haskell exercise https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D20/Exercise.hs It's not every day I codeThank you, #haskell, for today's solution to do sohttps://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D20/Solution.hs
- June 17th, 2016: My, my! Where has the day flown? Today's #haskell problem is to reinvent charting API! ... or not. https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D17/Exercise.hs
- June 16th, 2016: Today's #haskell exercise looks at representing $TWTR data as candlesticks https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D16/Exercise.hs
- June 15th, 2016: For today's #haskell problem, we round out the Data.Matrix module with the definition of the identity matrix https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D15/Exercise.hs There are many ways to define the identity matrix. Today's #haskell solution does so with Cellular Automata Rule 16 https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D15/Solution.hs
- June 14th, 2016: Yesterday we computed the matrix determinant, today we'll invert a matrix and use it to solve systems of equations https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D14/Exercise.hs Today's #haskell solution inverts a matrix BECAUSE WE FEEL LIKE IT! Yeah https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D14/Solution.hs
- June 13th, 2016: For today's #haskell problem we *ahem* DETERMINE (eventually) to solve systems of equations https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D13/Exercise.hs The determinant is the sum of the products of the first row with the sub-matrix determinants, right? RIGHT! https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D13/Solution.hs
- June 10th, 2016: Today's #haskell problem looks at box-and-whiskers charting of data https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D10/Exercise.hs Boxes for realz, yo: https://en.wikipedia.org/wiki/Box_plot The #haskell solution has @geophf writing 'uncurry uncurry' and sincerely meaning it! 😱 https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D10/Solution.hs and box:
- June 9th, 2016: Triangles are on my mind for today's #haskell problem: https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D09/Exercise.hs … 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 https://github.com/geophf/1HaskellADay/blob/master/exercises/HAD/Y2016/M06/D08/Exercise.hs
- ANNOUNCEMENT: lpaste.net is acting up; cloning original @1HaskellADay github repository and putting the exercise there. FYI
- June 6th, 2016: Today's #haskell problem explores superstring theory http://lpaste.net/6891096377267322880 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! http://lpaste.net/1128504074363207680
- June 1st, 2016: Today's #haskell problem is pretty much counting complements ... pretty much. http://lpaste.net/9130195410017583104 These apparently simple problems are actually rather hard. Today we have a #P-complete #haskell solution http://lpaste.net/670419007353913344
Tuesday, June 14, 2016
Wednesday, June 1, 2016
Thursday, May 5, 2016
Monday, May 2, 2016
- April 29th, 2016: In today's #haskell problem we look at a set of Top5s markets data and define/quantify what looks 'interesting.' http://lpaste.net/8121634490738016256
- April 28th, 2016: Today's #haskell problem looks at 'solving' when a solution is not known a priori, and parallizing with antz http://lpaste.net/8170491646400528384
- April 27th, 2016: Today's #haskell problem has the antz foraging further afield (that is, in a much bigger matrix) http://lpaste.net/5667147688521498624 See what they find! Well, would you look at that! Today's #haskell solution sends more ants and gets a less costly result! Whoda thunk? http://lpaste.net/216918736328720384
- April 26th, 2016: SUPER SIZE ME! ... no, actually, just size me appropriately for today's #haskell problem http://lpaste.net/2187209441198211072 Solution has cluster nodes sized by cell-counts in each cluster: http://lpaste.net/5818908382240702464
- April 25th, 2016: The ants are Swarming! Today's #haskell problem the antz come marching one-by-one, hurrah! http://lpaste.net/4502369819319861248 Today's #haskell solution only took 153 antz to find the solution. YAY! Go, antz! Go! http://lpaste.net/7244247769668386816
- April 22nd, 2016: Today's #haskell problem is @projecteuler problem 81, also known as (for me:) the Kobayashi Maru http://lpaste.net/4178250065082580992 You give it a go. Totally NOT the solution to today's #haskell problem http://lpaste.net/8058369802856562688 ... unless you have more computational power than the Universe.
- April 21st, 2016: Today's #haskell problem asks: what's a pandigital prime? And which one is largest? http://lpaste.net/504585569821523968 via @projecteuler problem 41 And the largest Pandigital prime is (Just a). Yup, you heard it here first for today's #haskell solution http://lpaste.net/5597599669644427264
- April 20th, 2016: Today's #Haskell problem brings us back to Douglas Adams or projecteuler.net or both! with problem 42 http://lpaste.net/8181950129519984640 Words, words, and triangular words for today's #haskell solution http://lpaste.net/859266571875385344
- April 19th, 2016: In a shocking announcement, @geophf admits he's not a Haskell programmer for today's #haskell problem http://lpaste.net/7447463975479934976 oh, and R-Trie. From "PAPA" to "MAMMA" in Relational Trie and the 3-4-5 Trie tiers http://lpaste.net/259046704735584256 for today's #haskell solution.
- April 18th, 2016: For today's #haskell problem we look at the (reverse) Trie for efficient search of work suffixes http://lpaste.net/4221347562226974720 Assessment of the reverse trie for word suffix search: eh. http://lpaste.net/1782747088124116992
- April 15th, 2016: Today's #Haskell problem relates original data to scores on the data http://lpaste.net/5271793028346937344 We relate clustered cells to source data to allow further exploration in #haskell solution http://lpaste.net/6768261699876159488
- April 14th, 2016: We recolorize scorecards or we reintroduce meta-data into colored cells, either way, for today's #haskell problem http://lpaste.net/4184247669083865088 Today's #haskell solution gives us cells in the clusters enhanced with metadata http://lpaste.net/8455891905392148480 We expand the scope of the solution with big-indices and 3000 data points:
- April 13th, 2016: Today's #haskell problem tells us not to shun words ending with 'tion.' eheh. http://lpaste.net/8081525869924843520 We 'Trie' hard to get common prefixes for today's #haskell solution http://lpaste.net/5059758395683241984 Eheh: using Trie data structure to find prefixes
- April 12th, 2016: In today's #haskell problem we relate clustered data http://lpaste.net/9073884707980050432 We have a #dataviz of clustered data for today's #haskell solution http://lpaste.net/8982640331094753280 using a #graph #database All the stocks in their clustersA query showing in which clusters AAPL, NFLX, and TWTR are
- April 11th, 2016: For today's #haskell problem we label then compact cells of heterogeneous data http://lpaste.net/6557878267389411328 Today's #Haskell solution gives us labeled, compacted data represented as SVG. http://lpaste.net/2873200763016839168
- April 8th, 2016: Today's #haskell problem LOOKS imposing, but it's really an Enum a reindexing problem; give it a go! http://lpaste.net/1555193256856256512 Today's #Haskell solution is 'fromEnum' http://lpaste.net/4814157348060790784 ... and this:
- April 7th, 2016: Today's #haskell problem returns to clusters, specifically 'clumping' (clustering) clusters http://lpaste.net/9172662547696844800 Today's #Haskell solution clumps clusters along mean-counts http://lpaste.net/4448502786170028032
- April 6th, 2016: You lookin' at Robert De Niro? Today's #Haskell problem: shoot him with Control.Arrow-syntax http://lpaste.net/6879084006575439872 with arrow syntax! http://lpaste.net/2056518229240578048
- April 5th, 2016: Today's #haskell problem is to create a symbol table compiler; wait, there's more: a symbol table compiler APP! http://lpaste.net/295071069348298752 So, today's #haskell solution wonders what happens if you're LOOKIN' at Rob't De Niro? ARE YOU LOOKIN' at HIM? http://lpaste.net/7366969987635871744
- April 4th, 2016: So, end of March we clustered some Market security data. Today's #haskell problem will query those clusters http://lpaste.net/5339634137026265088 So, in today's #haskell solution we learn $NFLX is in cluster 6 with 85 cells. http://lpaste.net/6805847212086525952 Hm. New clustering algorithm?
- April 1st, 2016: What if yesterday followed today? Today's #haskell problem: sorting unnormally-arrayed data, ... normalment oui. http://lpaste.net/3321894944162971648 We've 'resorted' to a better schema ... *groan* ... with today's #haskell solution http://lpaste.net/1909644297771155456