4 ms·
You would like to have 'unit system' that would keep track of the units of measure in general and the ability to use concepts like dimensional homogeneity to av
by nabla9 8y ago
You would like to have 'unit system' that would keep track of the units of measure in general and the ability to use concepts like dimensional homogeneity to avoid semantic errors while programming. Alas, they don't exist as far as I know.
- anonymou2 8y agohttps://pint.readthedocs.io/en/0.9/ https://pint.readthedocs.io/en/0.9/
- alkonaut 8y agoF# has units of measure. A frontend is (usually) not F#, but even for a more loosely typed system such as your typical web frontend, it should be possible to represent scalars as tuples of a number and an identifier. Eg. { qty: 12, unit: "kgs" }.
- carlmr 8y agoF# has this: https://fsharpforfunandprofit.com/posts/units-of-measure/ https://fsharpforfunandprofit.com/posts/units-of-measure/
- AKrumbach 8y agoA search on Google turns up this Common Lisp code, which appears to define a number of SI units (both base and derived) in the sort of manner described. http://www-ksl.stanford.edu/knowledge-sharing/lib/unit-conversion-agent/standard-units-and-dimensions.lisp http://www-ksl.stanford.edu/knowledge-sharing/lib/unit-conve... Given the way this appears to be defining some sort of class-based hierarchy, with the correct type requirements this code should perform exactly the sort of unit/type checking the grandparent post wanted, but I didn't go digging into the rest of the project files to confirm this code defined things in the correct manner for that to work.
- alehander42 8y agoNim also has it