Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    You do not need to be good at haskell to consider this idiomatic.
    In my mind this is more about understanding how folds work and not writing their definitions for each individual case.
    Similar thing is using map instead of defining your function to iterate over lists in a way that map does it. (I mean writing f = map g instead of f [] = [] and f (x:xs) = g x : f xs)
    You get used to it after a while :)

  • Custom User Avatar

    I wouldn't mix idiomatic with something that was used as an implementation standard. The fact that it's short and does the job does not mean it is readable when making a quick code review. I suppose I'll refrain from taking a strong stance untill I'm actually good at haskell

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Isn't this more code golf than best practice?
    I'm new so it might be it but it doesn't seem too obvious whats happening

  • Default User Avatar
    import Test.Hspec
    import Digitize
    
    test =
      (digitize 123 == [1,2,3]) &&
      (digitize 1 == [1]) &&
      (digitize 12 == [1,2])
    
    main :: IO ()
    main = hspec $ do
      describe "Test digitize" $ do
        it "123, 1, and 12" $ test `shouldBe` True
    
  • Custom User Avatar

    None of them have any example test cases...?

  • Custom User Avatar
  • Default User Avatar

    Good kata. Make your imports from module as

    import TheUsersModule (check)

    so it wont interfere with helper functions declared there.

  • Default User Avatar

    The haskell's version lacks any initial test case. I don't know what to put there.