Skip to content

fromheten/Komiform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Komiform

A Better Way to do Dependencies

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

TL;DR

(require 'komiform.core :refer [get-form publish!])
(publish! '(fn add2 [n] (+ 2 n))) ;=> "KTewcBHxQ8GFaNQ96IHfp72YtTM7BY90YccmiaGka94"
(let [add2 @(komiform.core/get-form "KTewcBHxQ8GFaNQ96IHfp72YtTM7BY90YccmiaGka94")]
  (add2 5)) ;=> 7

Installation

In project.clj or build.boot

Clojars Project

What's in a name?

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.

Testing

To run the test, you need to run the Komiform Server locally, so that the Clojure server is available at http://localhost:3000.

Problems you no longer suffer

  • Never again copy-paste code - not even when you are lazy
  • Semver
  • Having a bulky "shared" .jar for things different apps share

Honourable mentions

  • 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

About

A better way to do dependencies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published