Skip to content
Practical unit-of-measure calculator DSL for Clojure / ClojureScript
Clojure HTML Other
Latest commit e588c8e Jun 11, 2015 @martintrojer link to live demo
Failed to load latest commit information.
browser-example
dev run-all-my-tests May 5, 2014
examples Add browser example May 2, 2015
resources make (reset) work Aug 25, 2013
src/frinj Make add-with-plurals! cljs-compatible May 1, 2015
test/frinj/test fixing tests Jun 11, 2015
.gitignore Merge pull request #6 from smcgivern/browser_demo Jun 11, 2015
CHANGES.md
README.md link to live demo Jun 11, 2015
project.clj Add browser example May 2, 2015

README.md

Frinj

Frinj is a practical unit-of-measure calculator DSL for Clojure / ClojureScript.

Key features;

  • Tracks units of measure through all calculations allowing you to mix units of measure transparently
  • Comes with a huge database of units and conversion factors
  • Supports live unit feeds like currency conversion
  • Inspired by the Frink project (http://futureboy.us/frinkdocs/)
  • Tries to combine Frink's fluent calculation style with idiomatic Clojure
  • Supports infix calculation style

Usage

Add the following line into your Leiningen :dependencies [frinj "0.2.5"].

Clojure

user=> (use 'frinj.repl)
user=> (frinj-init!)
user=> (override-operators!)
user=> (fj 2000 :Calories :per :day :to :watts)
;; "1163/12 (approx. 96.91666666666667) [dimensionless]"

ClojureScript

There are a few differences when running Frinj on Node / in a browser. See this wiki page for details.

Browser demo

Visit the browser demo here

To generate the browser demo, run lein cljsbuild once. Then start a web server in the browser-example directory, and visit it. You should see the examples page.

For example;

$ cd browser-demo
$ python -m SimpleHTTPServer

then visit http://localhost:8000 in a browser and click on the demo.html file.

Examples

Finally, check out the wiki from more info.

License

Copyright (C) 2013 Martin Trojer

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.