Ad
  • Default User Avatar

    This has been fixed, I'll mark it as resolved.

  • Custom User Avatar

    You can copy and paste the code directly from DTALC, and that'd solve the whole kata, but it's also relative easy to just implement stuff along by solely looking at the types and nothing else. So it's not as bad as you described. (Even Lensmaker is like this, just with a boundary ridiculous amount of type awareness required)

    I do agree that this kata has a very bad description though. The initial code is far from sufficient to let people do anything, so in essence it's just an unreasonably high brick wall.

  • Custom User Avatar

    I don't know that the list comprehension can be used by this way :(

  • Custom User Avatar

    Note, that this pass2 fails on constant expressions more than 2 levels deep.

    (pass1 "[]1+2+3+4") `shouldPass2` (Imm 10)
    
    expected: Imm 10
            but got: Add (Imm 6) (Imm 4)
    
  • Default User Avatar
  • Custom User Avatar

    Here is still the issue (1 year old), as asQuirreL commented:
    "The before as defined in Tagless conflicts with the one defined in Hspec. I fixed it in the Sample Test Cases by just hiding before when importing Test.Hspec, but I obviously can't do that in your tests, so I am somewhat at a loss when trying to submit."

    Just write "import Test.Hspec hiding (before)" in the "Your Test Cases" section! Thank you!

  • Default User Avatar

    This is my favorite kata! ~6 hours to solve (all night)!

  • Default User Avatar

    Finally, I solved kata, but I haven't felt a lot of things. I'm confusing about deep theoretical background. In the end I just acurately copy-pasted some code from the hint and added some unimplemented parts. Also I think this "2 kyu" kata is harder to understand than "1 kyu" Tiny Three-Pass Compiler kata. In my opinion, all this stuff could be explained much simplier. For example:

    1. "Tiny Three-Pass Compiler" kata (1 kyu) - parse expression into simple tree.
    2. "Finally Tagless Interpreter" kata (2 kyu) - describe expressions by serializing of lambda calls.
    3. "Data Types a la Carte" kata (3 kyu) - how to flexibly extend existing data type.

    By the way, I fill these 3 katas are ranked by amount of possible copy-paste from the "hint" articles, really. 1. - no copy-paste, but very interesting to implement, 2. - middle amount of copy-paste from article, hard to understand, 3. - only copy-paste, even harder to understand what is going on.

    The main positive moment: increasing awareness about types, extensions and deep mechanisms of Haskell when you're solving such kata, so it's very useful in any case. Goog luck!

  • Default User Avatar

    Looks nice, really, but it doesn't handle one moment - when nim sum is 0 at the input (then there is error).

  • Default User Avatar
  • Default User Avatar

    Try to mark your question as an issue, seems like it can get some reaction then. I also can't finish this kata.

  • Default User Avatar

    I didn't hear about eta-conversion, I will study. About point-free I read again and again, but what I can't agree - someone says "Look, with points your code is more clear and nice", but in fact, it really leads to obfuscation.

  • Custom User Avatar

    You can think of it as partial application, at least with anagrams w, but the correct term is actually η-reduction.

    add3 x = x + 3
           = (+) 3 x
    -- eta-reduction:
    add3'  = (+) 3
    -- which is actually a partial application of (+)
    
    add3'' x = add3' x
    -- The eta-reduction yields: add3'' = add3'.
    -- But that's not a partial application of add3'.
    -- It is however, indirectly, a partial application of (+).
    

    The Haskellwiki contains an article on pointfree, which might interest you. Note that while pointfree-style is sometimes succinct, it can also lead to obfuscation.

  • Default User Avatar

    Great explanation. Thanks! So, as I understand, it is just a partial application?

  • Default User Avatar

    Cannot understand how does it really work. Can anyone explain? How "filter" gets correct filter function and compares every word in the list with some pattern (target word)...

  • Loading more items...