
Frink - tosh
https://frinklang.org/
======
heisenzombie
For people in Python-world, I've tried many units packages and tend to prefer
[https://pint.readthedocs.io](https://pint.readthedocs.io)

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](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.

~~~
duckerude
>[https://frinklang.org/frinkdata/units.txt](https://frinklang.org/frinkdata/units.txt)

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.

~~~
exikyut
Wow, I completely agree that file is a great read.

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.

------
Twirrim
I love these examples:

    
    
        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"

~~~
simias
Amusingly, this example wouldn't be nearly as impressive if you used metric
units instead.

~~~
arnarbi
Indeed

    
    
      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/6

~~~
maxerickson
Ur carpenter is amazing.

~~~
lucb1e
I'm not quite sure what this means, but your profile proves you're not a spam
bot, so I guess I won't flag it... did you submit this in the wrong tab or am
I missing something?

~~~
8_hours_ago
I’m guessing they meant that it would require a good carpenter to make a room
exactly 3m x 4m x 3m

~~~
ojii
How would it be harder than to make a room exactly 10 feet x 12 feet x 8 feet?

~~~
vlasev
I'm guessing they are from the US where carpenters work with feet and inches
rather than with meters.

------
tosh
The units file (and its comments) makes a thrilling read

[https://frinklang.org/frinkdata/units.txt](https://frinklang.org/frinkdata/units.txt)

~~~
gerdesj
There are some great notes in there and also things that you will almost
certainly not know already.

 _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)

~~~
oldandtired
Easy to fix

Hz == 1 revolution / sec

revolution == 2 Pi radians

The problem of not having the revolution as the conversion unit is the massive
oversight.

~~~
Firadeoclus
That wouldn't work because revolution would simply be a dimensionless number
which would define Hz as 2Pi/s. Which it isn't.

------
yeellow
Frink is really great as a sophisticated calculator (it is also quite powerful
and nice programming language, but I've never used it's full potential). It
helped me with cosmology classes assignments (very convenient unit conversions
and built-in all physical constants I could wish for) . I just wish it had a
better ide. I would love Frink Jupiter kernel with nice latex formula display.
I emailed the author about that, but he wasn't interested. Maybe some skilled
person from HN would take the challenge? Frink deserves more love, the amount
of details included there is amazing and it's one man job. Very impressive.

------
simcop2387
I've actually built a similar language directly inspired by this one. It's
been left to sit for a long time due to some issues with the implementation
and language itself.

[https://metacpan.org/pod/Language::Farnsworth](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.

~~~
jedimastert
>CPAN

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.

------
hardmath123
Frink is like 80% of the reason I passed first-year physics. It's like a
typechecker… for science!

~~~
ModernMech
Dimensional analysis is the original type checking.

------
tosh
A talk on Frink by its author (Alan Eliasen) from the Emerging Languages Camp
2010 in Portland
[https://www.youtube.com/watch?v=6NZ_qvQy5Cc](https://www.youtube.com/watch?v=6NZ_qvQy5Cc)

------
andrepd
Funny how one of the examples for translation

>"I will not buy this record; it is scratched." -> Spanish >No compraré este
expediente; se rasguña.

is wrong x).

~~~
moeffju
I think that is the joke, it's a reference to a Monty Python sketch about a
(deliberately?) wrong Hungarian phrasebook. "I will not buy this record, it is
scratched" is one of the examples in the sketch.

------
tniemi
How is this different than Unix `units`?

[https://en.wikipedia.org/wiki/GNU_Units](https://en.wikipedia.org/wiki/GNU_Units)

~~~
ModernMech
Frink is a (Turing complete?) programming language. GNU Units is a program.

~~~
simcop2387
Definitely Turing complete, I've implemented SKI calculus in both Frink and my
implementation Farnsworth.

------
lucb1e
Be sure to scroll down to the following part, where the author attempts to
validate a fart joke using Frink:
[https://frinklang.org/#FartJokes](https://frinklang.org/#FartJokes)

------
mwexler
Frink has been around for a long, long time, and the author has had a great
sense of humour about some of the units he's thrown in. While I rarely need
the tool, it's great to know that I can deal with cubits whenever I need to.

------
tosh
Mirror:
[https://web.archive.org/web/20180812184707/https://frinklang...](https://web.archive.org/web/20180812184707/https://frinklang.org/)

~~~
Athas
I'm surprised the site died. It looks like a static website, and even a small
webserver in a default configuration can serve thousands of files per second.

~~~
scotty79
I don't think it's static:
[https://web.archive.org/web/20170718015315/https://frinklang...](https://web.archive.org/web/20170718015315/https://frinklang.org/fspdocs.html)

------
kijduse
Yeah but can it convert US measuring cups to anything usable in the EU? I’m
still not even sure if it’s a weight or a volume.

------
sonofblah
It makes you laugh, it makes you think, and then the thing...with the
function?

Frinky's not loading so good right now, HN.

