Frink
frinklang.org
frinklang.org
https://www.gnu.org/software/emacs/manual/html_mono/calc.htm...
It's probably overkill for most people, and I'm sad that I don't get to use it as much as when I was a student, but it's still a beautiful rabbit hole to fall into. And it works in a terminal just fine. :-)
Reading the manual now...
https://frinklang.org/frinkdata/units.txt
Alan's editorializing on the nature of radians and hertz is my favorite thing.
// Alan's editorializing:
// I think the candela is a scam, and I am completely
// opposed to it. Some good-for-nothing lighting "engineers"
// or psychologists probably got this perceptually-rigged
// abomination into the whole otherwise scientific endeavor.
//
// What an unbelievably useless and stupid unit. Is light
// at 540.00000001 x 10^12 Hz (or any other frequency) zero
// candela? Is this expected to be an impulse function at
// this frequency? Oh, wait, the Heisenberg Uncertainty
// Principle makes this impossible. No mention for
// correction (ideally along the blackbody curve) for other
// wavelengths? Damn you, 16th CGPM! Damn you all to hell!
//Really delightful.
I don’t like the reference I have, though, so take this whole story with a grain of salt.
[1] https://phys.libretexts.org/Courses/Prince_Georges_Community...
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
https://github.com/gco/xee/blob/4fa3a6d609dd72b8493e52a68f31... // Beware the SI's broken definition
// of Hz. You should treat the radian as being correct, as a fundamental
// dimensionless property of the universe that falls out of pure math like
// the Taylor series for sin[x], and you should treat the Hz as being a
// fundamental property of incompetence by committee.
This is all quite entertaining.> In other words, if you use the Hz in the way it's currently defined by the SI, as equivalent to 1 radian/s, you can point to the SI definitions and prove that you follow their definitions precisely. And your physics teacher will still fail you and your clients will think you're completely incompetent because 1 Hz = 2 pi radians/s. And it has for centuries. You are both simultaneously both right and both wrong. You cannot win. You are perfectly right. You are perfectly wrong. You look dumb and unreasonable. The person arguing the opposite looks dumb and unreasonable.
[1] https://qalculate.github.io/ [2] https://pint.readthedocs.io/en/stable/
Just curious, as the Frink examples were all imperial. And examples like `10 feet 12 feet 8 feet -> gallons` are much less compelling in metric (eg, 3 metres x 4 metres x 2 metres in cubic metres is, uh, 24 cubic metres...)
If you use something with a sufficiently flexible type system you can combine these benefits, for example Haskell will let you mix physical units into the type system and have them statically checked: https://wiki.haskell.org/Physical_units
>Just curious, as the Frink examples were all imperial.
No worries. Internally Frink immediately converts everything into SI, actually.Fortunately Frink converts with zero loss of precision, because the language supports exact rational numbers. The unit definitions are all given in exact rationals, since they are (legally) defined as exact multipliers. For readability Frink introduces the "ee" ('exact exponent') notation, so for instance the standard acceleration due to gravity can be given as:
9.80665ee0 m/s^2
or (equivalently) in simplest form, as: 196133/20000 m s^-2
Frink treats these two quantities as exactly equivalent.Unfortunately it seems to be abandoned (last release was from 2010).
It also docks Frink with an 'X' because it doesn't have "Physical Dimensions," when in reality that's a core feature of Frink.
In Numbat you write:
dimension Length
whereas in Frink you'd write: length =!= m // meter set as default unit for dimension length
I'm not sure this comparison is exactly accurate.i'm open to non-FOSS licenses (and advocate for and use a class of them), but in this case 1. afaict, the license offers zero rights to the user 2. for me personally, i want more rights for a language than for an app, eg mongo
It’s a statically typed programming language for scientific computations with first class support for physical dimensions and units.
Great ergonomics and a pleasure to use!
Why do I have to scroll down 95% of the way to see some simple examples, when that's the first thing I'm interested in?
Why does it start with a list of "features" of like 25 unorganized bullet points?
Surely the long quotation about European kings belongs in some "history" or "origin" section, rather than the first thing I need to read, when I'm just trying to figure out if this is a) open-source, b) for which operating systems, c) actively maintained, and d) for quick calculations or complicated modeling?
Why do I have to scroll down a couple of page lengths just to get to the table of contents?
This is basically one of the worst landing pages for a project I've ever seen. It completely violates the basic principles of putting the most important information at the top, of organizing content hierarchically (don't ever just put 25 bullets in a row), and trying to show rather than tell whenever possible.
water := gram / cm^3 // Standard density of water (defined)
1 g/cm^3 is the maximum density of water at standard pressure (1 atm), which it reaches at 3.98°C.(Or at least, that used to be true by definition. Using the current definition of the kilogram, and the latest measurements of water density, the maximum density is actually closer to 0.99997 g/cm^3.)
https://frinklang.org/#HowFrinkIsDifferent
(That, and we warmly welcome Frink to the club of computer programming languages! (as we once did for Perl, Java, PHP, Rust, Clojure, Go, Zig, Nim, Python, etc. etc.!))
The website/GUI is just there for convenience and/or for people to get a taste.
>
// commonly used unit abbreviations e.g., m, ft, hr, mph, etc.
import static manifold.science.util.UnitConstants.*;
...
Length l = 5m; // 5 meters
Length height = 5 ft + 9.5 in;
Length distance = 80 mph * 2.3 hr;
Force force = 5kg * 9.807 m/s/s; // 49.035 Newtons
Force f = 49.035 kg m/s/s;
force == f // true
force == 49.035 N // true
1. https://github.com/manifold-systems/manifold/tree/master/man...*