Ad
  • Custom User Avatar

    Great kata! I've been slowly going through the test suite, now around 60 passing...

    I noticed a very minor issue, not affecting the coding. In the visual representation of this test:

       CH2
        / \
     H2C   CH2
       \   /
       HC-C
       //  \
       O    COOH
    
    2-oxocyclopentan-1-carboxylic acid = [('C', 6), ('H', 8), ('O', 3)]
    

    The Hydrogen on the bottom of the cycle (on C-2) is on the wrong carbon. It should be on C-1:

       \   /
        C-CH
       //  \
       O    COOH
    
    
  • Custom User Avatar

    May I ask You to add this awesome kata for JS)!!!
    I passed the first one and I really liked it.
    My heart desire more something like this.
    Thank You in advance! With all respect!

  • Custom User Avatar

    I have a few inputs regarding the Rust translation. I was unable to properly review it during translation stage, so these come a bit belatedly, but no one has solved yet, so addressing them shouldn't be a problem. Note: I'm going by the sample tests only, so far. I assume the proper tests have the same problems.

    • The description states "Wherever the spec mentions throwing an Exception, return a Result<_, ChemResult> instead. This should be "... return a ChemResult<_> instead."
    • Tests use unwrap() on the Result types, which generates an error if the wrong Variant is returned. Instead, the correct variant should be tested itself.
    • Many tests call Display::fmt on the Atom type. If that isn't implemented properly right from the start, then they all fail, making it hard to see whether the other stuff tested in each test fails or not. These should be decoupled.
    • Assertions use assert_eq, which outputs its own assertion message in addition to the one you provide, causing a wall of text (especially for longer molecules) and creating redundancy. You get
    left: x
    right: y, x should be y
    
    • Imagine x and y are 10 lines long each, you get the picture. Since you are using macros for this, you should really create your own custom assertion (using assert!() or simply panic!()) that neatly formats the results and makes them legible.
    • The sample tests are huge. I know this is a necessity and conforms to previous translations, but maybe try and move the implementation details (e.g. macros) to the bottom, if possible, so that users have an easier time finding and parsing tests.
    • Note that tests are run in alphabetical order, so if you want a specific order, be sure to name your modules and tests accordingly. This will require creativity, I speak from experience ;)
  • Custom User Avatar

    Could someone please do a JavaScript translation of this kata?:)

  • Custom User Avatar

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

  • Custom User Avatar

    I think there might be a discrepancy in your numbering of "alkanoyloxy" esters.

    Example 1, from the description:

                 CH3                                vvvvvvvvvvvv
     vvvvvvvvvvv |                          ->   "4-propanoyloxypentanoic acid"
     CH3-CH2-C-O-CH-CH2-CH2-C=O                    
            ||              |
             O              OH                    (note the absence of squared brackets, again)
    

    This shows that "propanoyloxy" is like a carboxylic acid, with a =O at C1, which links to the Root via a -O.

    Example 2, from the static tests:

    15-[1,2,2-triamino]propenanoyloxy-2,4,5,12-tetra[2-[[4,5,5-tribromo-1,4,6,7-tetrachloro]hept-2-enyl]arsino[1,2-diamino]ethenoxycarbonyl]hexen-3,5-diynylhexadec-10,13-diynoic acid
    

    Specifically, look at the "15-[1,2,2-triamino]propenanoyloxy" substituent. So:

    • C15 on the hexadec-10,13-diynoic acid, there is an ester bond. Cool.
    • The ester's ketone component is on the substituent, not on C15, as this is an "alkanoxy". If this were not the case, and the ketone were on C15 of the Root, that C15 would be pentavalent, linking to C14, C16, Ester-O, and Ketone-O x2. Cool.
    • Thus, C1 of the substituent holds both Os of the ester bond. But it also links to C2 of the constituent, and it also links to an amino group, apparently. So it must be pentavalent, i.e. invalid.

    What am I missing here? Or is there an error?

  • Custom User Avatar

    I have a question about the addChaining method. The description says As for the add method, this chain is not considered as a new branch of the molecule. If this is the case what is the chain? You give the example of -C-C-C-Mg-Br. I'm imagining that bonded to a C at a 90 degree angle. How is this any different from any other branch in the molecule? If it isn't a branch, what makes it not a branch and what makes a branch a branch?