bert-clj is an implementation of mojombo’s bert in clojure. It is currently ready for use, but not tested in a real environment. Please try it out and file bug reports. I’m happy to fix anything that’s wrong with it.
There are two ways to use bert-clj. One, you can just add bert-clj/src/main/clojure to your classpath. If you take that route, you can then do the following:
> (require '[com.trottercashion.bert-clj.bert :as bert]) > (bert/encode 72) ;; => (-125 97 72) > (bert/decode '(-125 97 72)) ;; => 72 > (bert/decode-seq '(-125 97 72 -125 97 53)) ;; => (72 53)
Alternatively, you can use maven to assemble a jar that can then be added to your classpath. On the command line, do the following:
$ mvn assembly:assembly $ java -cp target/bert-clj-1.0-jar-with-dependencies.jar clojure.lang.Repl > (require '[com.trottercashion.bert-clj.bert :as bert]) > (bert/encode 72) ;; => (-125 97 72) > (bert/decode '(-125 97 72)) ;; => 72 > (bert/decode-seq '(-125 97 72 -125 97 53)) ;; => (72 53)
Trotter Cashion (cashion@gmail.com)