Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Yes, I exploited lack of random tests
python new test framework is required.
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 of2
, 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
.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?
Python: Random tests are vulnerable to input modification
Python: see this
The description says:
But
a.u
is an instance of the classU
which does not have a copy constructor.This also implies that we should copy the attributes when
getattr
is called, but theit_5
tests don't follow this, in particular with this test: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.)
OK, issues resolved, please republish now.
ETA: Yay! :D
Thank you very much.
Sorry, I lost focus and could have turned to this somewhat later only..
proposed fix ( addresses more than just this issue )
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.
Maybe I'm too technically minded, but I would just like to see "all
infix
ed 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! )
ad 2: could even have
infixl
andinfixr
for left and right associativity ( with precedences ).room for a sequel?
ETA: created and published
Loading more items...