Ad
  • Custom User Avatar

    It was fun to discover nega-binaries. But in the meantime, I realized that ternary (base 3) numbers offer negatives more naturally by using the digit -1 instead of 2, so we have numbers ..., ˧11, ˧˧, ˧0, ˧1, ˧, 0, 1, 1˧, 10, 11, 1˧˧, ....

    Also, for binaries we can simply add another terminator besides the zero end, which corresponds to infinite 1 digits to the left, but it actually acts in all means as -1.

  • Custom User Avatar

    Nice!

    How was using negabinary for you?
    Do you think it's better than just using signed magnitude would be, or is it over the top? It makes some things more complex, and others less, than in signed magnitude, but is it overall a good encoding, is it a good trade-off?

  • Custom User Avatar

    Python: Random tests are vulnerable to input modification

  • Custom User Avatar
  • Custom User Avatar

    The description says:

    We can assume that each attribute has its copy constructor implemented.

    But a.u is an instance of the class U which does not have a copy constructor.

    This also implies that we should copy the attributes when getattr is called, but the it_5 tests don't follow this, in particular with this test:

    a.u.x += 8
    

    If I actually copy the attributes, I fail this test.

    (I would also like to bring attention to this unresolved issue from 4 years ago, which also caused me some frustration.)

  • Custom User Avatar

    OK, issues resolved, please republish now.

    ETA: Yay! :D

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Thank you very much.
    Sorry, I lost focus and could have turned to this somewhat later only..

  • Custom User Avatar

    proposed fix ( addresses more than just this issue )

  • Custom User Avatar

    TODO: random tests

    ( I know you know. but publishing without them is just a bad idea. you can always ask people to review your unpublished kata in Discord! with a link, it's solvable, even if not submittable. )

    ETA: Do you need help writing random tests? I could do ( parts of ) that.

  • Custom User Avatar

    Maybe I'm too technically minded, but I would just like to see "all infixed operators have equal precedence, and associate to the left" ( or similar jargon ). The "natural flow of operations" is just too English, and not enough maths, for my tastes.

    Other opinions may be available. ( If so, let's hear 'em! )

  • Custom User Avatar

    ad 2: could even have infixl and infixr for left and right associativity ( with precedences ).

    room for a sequel?

    ETA: created and published

  • Custom User Avatar

    Cool kata, some thoughts:

    • I don't really see the value in requiring solvers to define operations like add, comp, etc? Is the intent that people might define these in clever ways as part of making Infix work?
    • You could potentially support arbitrary precedence by adding an extra number argument to infix, but of course that would make the kata harder, and maybe would distract from the main point?
  • Custom User Avatar

    Indeed, thanks for clarifications. Added true, false, if as requirement.

  • Loading more items...