Ad
  • Custom User Avatar

    Here's the test that I suggest to add (Haskell) which I believe is correct. My solution fails it but still passes current full test suite.

        it "one letter diff, others shuffled" $ do
          aSmallDifference "word" "crow" `shouldBe` False
    
  • Custom User Avatar

    @Twilight_Sun, it is actually a valid puzzle:

    There are 10 distinct letters: AEFHILORST, nine distinct leading letters: AFHILORST, and solution without leading zeroes does exist.
    (It's easy to deduce here that E is 0 although no special-case for this deduction is needed to code it).

  • Custom User Avatar

    ha, have already read that book ;) It's really good and practical although I still have no clue how exactly lens types work together.
    One last thing is to get paid for doing Haskell somehow

  • Custom User Avatar

    a bit verbose but efficient

  • Custom User Avatar
  • Custom User Avatar

    Sure. Both list spine and elements are lazily evaluated in Haskell. The list that times out is short in spine, but the last element takes forever to evaluate.
    So in Haskell version you need to find the answer without ever touching the last element (!), which makes it very different and much harder than same kata in any other language

  • Custom User Avatar

    Not sure if that counts as spoiler but there's an article on fpcomplete.com about lenses that explains a lot and is very helpful for this kata (it is required to have idea about RankNTypes though)

  • Custom User Avatar

    after few failed attempts to submit an O(n) code (12 sec timeout) I gave up and unlocked solutions. Most of them are less efficient and none of few that looked interesting passed the tests, all failed with timeout

    UPD: it did pass with a near miss time after repeatedly submitting the same code many times.

  • Custom User Avatar

    Tests don't verify cases when letters are reshuffled. E.g. "word" and "crow" have only one replaced letter (d vs c) but other letters are reshuffled so answer should be False. I wrote more blunt solution that doesn't check letter positions and it still passes.

  • Custom User Avatar

    I'd allow one extra character for at least some variability in possible solutions, and they would still require firm grasp of the concept

  • Custom User Avatar

    man I need to learn lenses too

  • Custom User Avatar

    Haskell descriptions should be explicit that import WordList is required to bring wordsList into scope. This is the only thing that can explain such a low number of Haskell submissions (3 + one mine after I unlocked solutions only to find out how to bring wordList into scope)

  • Custom User Avatar

    Wow that was much trickier than it looks :) Glad to discover that my ad hoc solution is relatively clear and readable, I expected to find out something much more simple and elegant upon submit

  • Custom User Avatar

    OK, thanks. Then probably tests in other one are weak because I passed it with solution which doesn't care about the order. Will post a counter-example there

  • Custom User Avatar

    Description mentions another kata and claims to be the same / more performant version of it. The other kata however has different rule: "subsequence need not be consecutive terms of the original sequence" whereas in this kata order matters.

    For example solutions to this test example would be different:

    lcs "nothardlythefinaltest" "zzzfinallyzzz"

    this kata expects "final", the other one would accept "afillny"

  • Loading more items...