Komiform is a library for sharing code.
It has 2 functions of intrest - publish!
and get-form
.
-
publish!
takes a Clojure form and uploads it, giving you a hash of the form back. The hash is the globally unique ID of your form. No 2 forms can ever have the same ID. That is why hashes are better than names, for identification. -
get-form
takes a hash and returns the form, evaluated. It keeps a local cache, so you only ever do one network request (much like Maven does in~/.m2
).
(require 'komiform.core :refer [get-form publish!])
(publish! '(fn add2 [n] (+ 2 n))) ;=> "KTewcBHxQ8GFaNQ96IHfp72YtTM7BY90YccmiaGka94"
(let [add2 @(komiform.core/get-form "KTewcBHxQ8GFaNQ96IHfp72YtTM7BY90YccmiaGka94")]
(add2 5)) ;=> 7
In project.clj
or build.boot
Like all great works of art, this library was written because I can up with a pun for the name. "Kom i form" means "get in shape" in Swedish, which I thought was funny because the library is about handling forms in a blazing fast way.
To run the test, you need to run the Komiform Server locally, so that the Clojure server is available at http://localhost:3000
.
- Never again copy-paste code - not even when you are lazy
- Semver
- Having a bulky "shared" .jar for things different apps share
justin_smith
@ freenode irc, for always being there and answering peoples questions. What a champion!- Joe Armstrong of Ericsson fame for inspiration on why names suck as identifiers