I’d like to hear Erik’s opinion (I’m sure he’ll post here if/once he has time) and others’ opinions too. That might take a week or so for everyone to chime in. Until then, we wait!
My thoughts.
- If the input is in a string format, I suspect a big part of this exercise will end up being the parsing.
- Getting the intro/instructions simple and clear might take a bit of work.
- Overall, I think this can be a good addition.
I feel exactly the same as Isaac. Having a parsing exercise is a good addition, we just have to be careful to make the rules as simple as possible.
How is the exercise, do you want help with theory or tests?
I was a chemist, too. I researched some approaches to balance chemical equations for myself, and I ended up with that, in general, one has to use a system of linear equations to balance chemical equations, especially for some redox reactions.
Yes, exactly, I was doing the same, but in this exercise other methods would be used .
How’s the exercise going, do you want to help with anything?
I assume you mean subscript?
For the inputs/unbalanced equations, IIUC all numbers are always “atom counts (right subscript)”. That makes input parsing a bit easier. The input is always of the form ([A-Z][a-z]?[0-9]*)+ <and> ([A-Z][a-z]?[0-9]*)+ <gives> ([A-Z][a-z]?[0-9]*)+
.
Is that assumption about the numbers in the unbalanced equation correct, @davidh24?
@iHiD If that assumption is correct, do we need subscript numbers in the input?
For the balanced equation, IIUC there will always be exactly one coefficient value which will always be to the left of the molecule. All other numbers will be “atom counts (right subscript)”:
(?<COEFFICIENT>[0-9]+)([A-Z][a-z]?[0-9]*)+
If that’s the case, and is explicitly communicated, does that make the numbers less confusing and do away with the need for subscripts/superscripts?
@davidh24 The exercises on Exercism are built by volunteers. The Exercism staff is two people (Jeremy and Aron) and their focus isn’t on building out new exercises. The flow to introduce a new exercise here is to develop consensus among the volunteer maintainers, sometimes require a thumbs up from Jeremy, then the proposer (that would be you) would create the exercise. I think we’re waiting on a thumbs up from Jeremy, and consensus on details.
Then it’d be up to you to come up with a story and a really, really clear set of instructions which does not assume any prior knowledge about chemistry (communicated in this thread) and getting maintainer consensus.
Yes, you’re right — all numbers in unbalanced equations are subscripts (atom counts), not coefficients. Only the balanced form includes coefficients before molecules, they are on left side.