Unchained
unit_fun
Our great sponsors
Unchained | unit_fun | |
---|---|---|
5 | 1 | |
105 | 21 | |
4.8% | - | |
7.0 | 0.0 | |
about 1 month ago | over 5 years ago | |
Nim | Elixir | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Unchained
-
GNU Units
Anything with a finite (200 is small even) number of units misses the algebraic structure of the problem mentioned in https://news.ycombinator.com/item?id=36988497 wherein multiplying|dividing two things gives you a (potentially) new unit which implies an open ended "space" of units.
To be concrete (hah!), in C++ a template meta-type with 12 signed integer parameters (6 numerators & 6 denominators for rational exponents of SI base units) might be one way to model it.
Unlike C++ template stuff, Nim macros (like Lisp macros) makes metaprogramming more like procedural programming - just against abstract syntax trees. I think that helps to shield some of this type complexity from users, but the documentation README https://github.com/SciNim/Unchained does better job than I can in an HN comment.
Of course, for unit system conversion, the number of dimensions (6 in SI, 3 in CGS/Gaussian) changes. So, for full generality you need compile-time (if you want static type integration/CT errors) linear algebra over a rational field (at least & conventionally) to project|inverse project. That might be theoretically possible in C++. I would think it very un-fun and unlikely to ever have been done. There's probably a Mathematica package, though.
- Please Put Units in Names
- Pint: Makes Units Easy -Python
-
Atlas, a (hopefully) better engineering IDE
I've recently written a units library for Nim [0]. It's still WIP, but it's already proven extremely useful for me as a physicist.
Thanks to Nim's strong type system and metaprogramming features, it allows for a fully compile time design, without any runtime overhead (in form of special unit objects or such things; everything is a `distinct float`).
In addition Nim's unicode support, the code even looks nice!
A more complex use case (I can link more if desired): [1]
[0]: https://github.com/SciNim/Unchained/
[1]: https://github.com/SciNim/Unchained/tree/master/examples
unit_fun
-
Please Put Units in Names
I ended up building a library for elixir a few years back for this kind of thing: https://github.com/meadsteve/unit_fun.
What are some alternatives?
SI - A header only C++ library that provides type safety and user defined literals for physical units
slime - Minimalistic HTML templates for Elixir, inspired by Slim.
mosdepth - fast BAM/CRAM depth calculation for WGS, exome, or targeted sequencing
secure_random - Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom
nimbus-eth1 - Nimbus: an Ethereum Execution Client for Resource-Restricted Devices
expletive - Profanity filter library for Elixir
nimview - A Nim/Webview based helper to create Desktop/Server applications with Nim/C/C++ and HTML/CSS
bencode - A bencode encoder and decoder written in Elixir
zen
chinese_translation - An elixir module to translate simplified Chinese to traditional Chinese, and vice versa, based on wikipedia data
phpmnd - PHP Magic Number Detector
eden - edn (extensible data notation) encoder/decoder for Elixir