For the bedroom example someone posted, here's the equivalent in pint:
import pint
# Possibly my least favorite thing about Pint is
# the verbose importing/instantiating dance
u = pint.UnitRegistry()
q = u.quantity()
# there are multiple ways of making <Quantity> objects:
volume = q('10 feet') * q(10, 'feet') * (10 * u.feet)
volume.to('gallons)
# How deep could you fill the room?
(q('2 tons') / (q('10 feet') * q('12 feet') * u.water/u.gravity)).to('feet')
Notes:- Pint has far fewer material property entries in its database (though one can make arbitrary unit registries --- I'm wondering about an importer for the Frink ones... but https://frinklang.org/frinkdata/units.txt doesn't seem to have a license?)
- That said, I'm not wild about Frink's treatment of material properties: Why is the constant `butter` a density, but `eggwhite` a mass, and `naturalgas` a specific energy?
- Pint works (mostly) nicely with numpy and can (sometimes) drop into existing code, since <Quantity> objects quack like builtin numbers.
I haven't even tried the software yet, but that file is a great read. An excerpt (part of a rant about the definition of the candela):
// What really annoys me is that the official definitions
// don't come right out and say, "okay, we're sorry, this
// is obviously a useless definition for any other
// wavelength, and it doesn't even make sense for *that*
// wavelength. We know. It sucks. The guys at the 16th
// CGPM went out and got drunk the night before instead of
// working on the definition, and they all sheepishly passed
// this in in the morning, and went back to bed. They got
// fired later, make no doubt. It's on our list of bugs.
// We're sending in the Wolf to fix it directly.
// Here is the workaround, but we consider it broken
// and we're ashamed to have ever put it forth in this
// useless form and left it this way for 30 years.
// For now, here is one single draft standard equation to use
// for other wavelengths. Download it here. We promise
// that the link works and contains a computer-readable
// table (though we're too sloppy to actually create a good
// smooth polynomial fit that would be a lot cleaner and
// easier for everyone) and is not some PDF of a terrible
// unreadable old re-scan, stashed away somewhere, making
// you wonder if it's valid today, nor is it a ridiculous CIE
// document that you have to *pay* a hundred bucks for, when
// we could and absolutely need to distribute it for free.Also, for reference, the closing " is in the following paragraph, but I'm not quoting it because the 2 paragraphs after that one made opening the link worth my time.
That data is almost all taken from GNU Units, including the descriptions, which means it might be under the GPL. Frink itself doesn't seem to be open source at all?
I wrote a parser and interpreter [1] for the GNU units descriptions a while ago, you can see the parsed json here [2] (kg! are base unit definitions, "micro_" are prefixes)
[1] https://github.com/phiresky/qalc-react
[2] https://github.com/phiresky/qalc-react/blob/master/data/gnu-...
This is just a list of facts, no? You can't really copyright such a thing.
Why not ask if there is a license for this file?
Edit: And as I see in this thread there is gnu-units (https://en.wikipedia.org/wiki/GNU_Units) probably there is something with a license.
Let's say you wanted to fill your bedroom up with water. How much water would it take? Let's say your room measures 10 feet by 12 feet wide by 8 feet high.
10 feet 12 feet 8 feet -> gallons
552960/77 (approx. 7181.298701298701)
It would take approximately 7181 gallons to fill it. Note that you get both an exact fraction and an approximation. (If you don't want to see the fraction, put a decimal point in any of the numbers, like 10. or 10.0.) How much would that weigh, if you filled it with water? Frink has the unit "water" which stands for the density of water.
10. feet 12 feet 8 feet water -> pounds
59930.84215309883
So it would weigh almost 60,000 pounds. What if you knew that your floor could only support 2 tons? How deep could you fill the room with water?
2. tons / (10 feet 12 feet water) -> feet
0.5339487791320047
So you could only fill it about 0.53 feet deep. It'll be a pretty sad pool party.
This sits firmly in the "Neat, and now I'm sad I don't have a practical use case for this" 3 m 4 m 3 m -> liters
36000
3 m 4 m 3 m water -> kg
36000
2 metricton / (3 m 4 m water) -> m
1/6How much air in your room weighs?
What power do you need to transfer energy at the same rate as when you fill tank of gasoline?
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.
[...]
Either way, if I ever develop a time machine, I'm going to go back and knock both groups' heads together. At a frequency of about 1 Hz. Or better yet, strap them to a wheel and tell them I'm going to spin one group at a frequency of 1 Hz, and the other at 1 radian/s and let them try to figure out which one of those stupid inconsistent definitions means what. Hint: It'll depend on which time period I do it in, I guess, thanks to their useless inconsistent definition changes.
The rest of the diatribe on Hz ends up amusingly spittle flecked with some decent frothing in evidence. I always knew that the kilo was bollocks (lump in a jar) but that barely gets a nod here. I had no idea about the state of some of the other units (like Hz)
Hz == 1 revolution / sec
revolution == 2 Pi radians
The problem of not having the revolution as the conversion unit is the massive oversight.
> In short, candela = EPIC FAIL.
https://metacpan.org/pod/Language::Farnsworth
I originally built it because I wanted an easier to integrate version into an IRC bot, the java implementation of Frink was hard to integrate safely (keep it from running too long, max memory usage, etc.) at the time and having a native perl version made handling a lot of that easier.
Language wise, the problems I ran into were that, at least in my implementation, it began to get very difficult to parse a lot of things unambiguously and I couldn't solve them without a larger redesign of the language. In particular handling arrays and making user defined types easier to use and make (you can emulate that right now with currying and closures to make function calls simpler). I never got it past that step because I didn't want to do a complete redesign of the language and break all compatibility, right now about 80% of all Frink programs will probably just work fine in Farnsworth, and 90% with some minor tweaks.
Huh. I don't know why, but I never thought I'd see a Perl project anywhere in HackerNews. There might literally be dozens of us.
>"I will not buy this record; it is scratched." -> Spanish >No compraré este expediente; se rasguña.
is wrong x).
Frinky's not loading so good right now, HN.