7 kyu

Multiply Adjacent Digits

225 of 384shreedave
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • lolidior Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    JS translation added. No leading minuses ( correctly this time ).

  • beaver1334 Avatar

    not 7kyu at all

  • JohanWiltink Avatar

    I am still unhappy about the possible leading minus sign: it's a unary minus, where all the others are binary ones.

    Especially now that this is approved at 7kyu, I would like to suggest to remove this special case. For a 7kyu, it's already complicated enough ( can you tell I voted 6? ).

    When solving with eval, this is not a problem, but when solving with a parser, it definitely complicates things.

  • rowcased Avatar

    the input parameter string overwrites the Python module of the same name

    N.B. that str should not be used as a replacement, as that would overwrite the Python function by that name

    perhaps consider a variable name based on the concept of what's presented, which is a "calculation" or possibly an "expression"...

  • JohanWiltink Avatar

    ( Python )

    random tests generate a lot of cases that expect 0.

    generating smaller numbers would help, removing 0 from available digits would also help.

    note that the current random generator can generate numbers that start with leading zeroes; that is a choice - solvers might not expect that and might or might not handle it correctly ( most code will handle leading zeroes gracefully ofc ).

  • JohanWiltink Avatar

    Haskell translation

    this translation modifies the description. check you're OK with that.
    this translation generates slightly different random inputs than the Python version. if you can read Haskell, check you're OK with that. if you can't, just take my word for it. :P

    in general, accepting translations before approval is .. a choice. but I don't expect the specs to change, and the translation is probably solid ( famous last words .. ).

    • rowcased Avatar

      I sometimes reserve judgement on a new kata; uncertain whether it may be erroneous, a duplicate, or rife with issues. In this case, seeing that Johan was willing to submit a translation, it hereby earns my upvote.

    • JohanWiltink Avatar

      I just wanted to write a parser-based solution and a foldr-based one in Haskell ( which does not have eval, does have a parser library I actually know, also has foldr, which apparently is not Pythonic enough to even include in Python, and also I generally find it easier to write Haskell than Python ), and I figured I might as well translate the kata if I had all that code already.

      Publishing a translation is not necessarily an endorsement. ( But if it were riddled with issues, I probably wouldn't bother publishing one, you're correct there. )

    • dfhwze Avatar
      Suggestion marked resolved by dfhwze 5 months ago
    • JohanWiltink Avatar

      .. and the specs changed after all. :]