Drasil
Drasil copied to clipboard
Make function for formatting ordinals (1st, 2nd, 3rd, ...) consistently
Note that this should probably be tackled in multiple PRs, but since the fixes are interconnected, I included them all in one issue; smaller issues can be split out as seen fit.
I noticed that we don't really have a consistent way of dealing with ordinals, and our current methods are either really bad or inconsistent (see below for specific examples).
TODO
- [ ] Improve GamePhysics's handling of quantities with ordinals in their definition to refer to the actual index $j$ (creating it if it doesn't exist)
- This should involve creating a new function, that should be able to be reused for other instances of ordinals
- [ ] Use this function where applicable in SSP
- [ ] Introduce handling of ordinals from just straight numbers, either in a new function or adding functionality to the previously mentioned one and use in SSP
- This will be interesting with Haskell's strong typing
- [ ] Reuse the function for ordinals from numbers in references
- There is currently a function (
sufx
) for dealing with this in the context ofString
s and references; this could be the basis of a previous task but should be "upgraded"
- There is currently a function (
- [ ] Decide on how to format ordinals: "j th" vs. "j-th " vs. "jth" - "j th" shouldn't have a space, but Markdown needs it for rendering
- This is the lowest priority and can be done at any time
- Me and Dr. Smith currently prefer "j th": it seems the most reusable and not unnecessarily complicated
Really Bad (GamePhysics)
Example Implementation:
https://github.com/JacquesCarette/Drasil/blob/9153523ef3bed37e20808b26e0b4f2854d1b3ebf/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/Unitals.hs#L185-L187
Affected Unitals: massj
, posj
, accj
, angAccj
, velj
, torquej
, massIRigidBody
, rRot
, and forcej
There are also some comments that should either be removed in a separate PR or updated to use the new function:
https://github.com/JacquesCarette/Drasil/blob/9153523ef3bed37e20808b26e0b4f2854d1b3ebf/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/IMods.hs#L154-L163
Inconsistent (SSP)
https://github.com/JacquesCarette/Drasil/blob/9153523ef3bed37e20808b26e0b4f2854d1b3ebf/code/drasil-example/ssp/lib/Drasil/SSP/Assumptions.hs#L93-L95
Affected Sentence
s: In addition to edgeS
above, momEqlDerivNormaliM1Sentence
and fctSftyDerivSentence12
use eS (sy index $- int 1) :+: S "th"
and ch numbSlices :+: S "th slice"
, respectively.
@balacij Issue finally created! 😅
I agree @samm82 - I also like "j th".