Nextjournal is using this library. I was asked to make this library compatible with babashka.
I wonder if you are willing to accept this back into the original library or if we should maintain our own fork.
I'd be happy to discuss next steps if you're not happy with something in this PR.
I've made the following changes that do not affect the behavior in CLJ and CLJS (with regards to the unit tests at least):
In babashka a multi-hash is a defrecord rather than a deftype (bb does not support deftype at the moment)
Added support in babashka itself for overriding toString on a record (will be available in next release)
Added algorithm, digest and length API functions, rather than going through ILookup via keywords. Implementing ILookup isn't supported by babashka yet. I also added these API functions for CLJ and CLJS, since I don't think it hurts to have them as an alternative for invoking these functions via keywords (it might even be seen as a tad more idiomatic). The tests use these new API functions. I can add back some tests to exercise the ILookup access which I realize isn't tested anymore.
Upgraded to mvxcvi/alphabase "2.1.0". Not sure if this should be done in project.clj since I'm not sure what effect this has on compatibility with previous Clojure versions, but at least that newer version runs well with babashka.
Added bb.edn so you can easily run babashka tests with bb test.
Feel free to squash-merge all commits into one single commit. I can also do this prior to merge if you want.
Locally all tests pass:
$ bb test
Testing multihash.core-test
Testing multihash.digest-test
Ran 11 tests containing 391 assertions.
0 failures, 0 errors.
$ lein test
lein test multihash.core-test
lein test multihash.digest-test
Ran 11 tests containing 392 assertions.
0 failures, 0 errors.
$ lein cljs-test
WARNING: :preloads should only be specified with :none optimizations
;; ======================================================================
;; Testing with Phantom:
Testing multihash.core-test
Ran 8 tests containing 370 assertions.
0 failures, 0 errors.
Nextjournal is using this library. I was asked to make this library compatible with babashka. I wonder if you are willing to accept this back into the original library or if we should maintain our own fork. I'd be happy to discuss next steps if you're not happy with something in this PR.
I've made the following changes that do not affect the behavior in CLJ and CLJS (with regards to the unit tests at least):
toString
on a record (will be available in next release)algorithm
,digest
andlength
API functions, rather than going throughILookup
via keywords. ImplementingILookup
isn't supported by babashka yet. I also added these API functions for CLJ and CLJS, since I don't think it hurts to have them as an alternative for invoking these functions via keywords (it might even be seen as a tad more idiomatic). The tests use these new API functions. I can add back some tests to exercise theILookup
access which I realize isn't tested anymore.mvxcvi/alphabase "2.1.0"
. Not sure if this should be done inproject.clj
since I'm not sure what effect this has on compatibility with previous Clojure versions, but at least that newer version runs well with babashka.bb.edn
so you can easily run babashka tests withbb test
.Feel free to squash-merge all commits into one single commit. I can also do this prior to merge if you want.
Locally all tests pass: