Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Frink programming language (ncreep.github.io)
51 points by mamcx on Jan 15, 2015 | hide | past | favorite | 11 comments


If you enjoyed this blog post, you'll find the Frink author's own examples at least as entertaining:

https://futureboy.us/frinkdocs/#SampleCalculations


This seems to be an arbitrary collection of typedefs and consts. I mean look at the definition of 'moondist'. This is a single value and is measured from where? I mean the distance from earth to moon is somewhat static but what about the distance from Venus to the moon.


It's the distance from the earth to the moon, obviously. Why would it be anything else? Why would you care about the distance from anything else to the moon?

And yes, it's a big ad hoc bag of hopefully-useful values. It turns out that a big ad hoc bag of hopefully-useful values is, in fact, sometimes useful.

(Of course there's more to Frink than its big bag of handy predefined values. But I take it it's only the big bag of handy predefined values you're criticizing, and indeed that is one of the more interesting features of Frink.)


Looks like there's a simple web interface [1] and Android app [2]

[1] https://futureboy.us/fsp/frink.fsp

[2] https://futureboy.us/frinkdocs/android.html


Someone implemented this idea of typed units for the Nim programming language: https://github.com/def-/nim-units/blob/master/units.nim#L216


A similar thing can be done with dependent types: https://github.com/timjb/quantities


It's funny this is coming up today.

I was bored the other day and put up some old C++ code. [1] Some years ago I was playing around with C++ templates (pre C++11) to see how far I can go and I came up with exactly that kind of unit checking and conversion. The trickiest part was eliminating common terms when dividing units but once you figure out how to approach it, it's not that hard. Complete unit inference is definitely possible and maybe even worthwhile depending on your use case.

That said, it is still just some experimentation, but maybe someone feels inspired :)

[1] https://github.com/jpommerening/template-hell.git (Note: don't expect proper documentation yet, I'm still figuring out how to structure namespaces there, etc.)

Edit: I remember the over-the-top template substitutions made XCode 3 crash back in the day. You have been warned.


Neat idea. I generally just use Wolfram|Alpha for these types of calculations, but Frink seems more programmable and doesn't require an Internet connection.


it also interface with java code easily, providing a simple interface if needed.

(And I think it's from a dozen years ago, W|A was still a dream at the time :) )


Years ago, when I was doing laboratory programming, I wrote a set of c++ classes for numbers with units. It tracked units through the calculations (and managed significant figures). It even allowed for such stuff as dividing mass by volume to return a density or generating a volume by multiplying three lengths together. It was very useful for the task at hand, which was flowmeter calibration.


While I find this language neat, I think that there should be a warning that it is proprietary/not open source.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: