Dear list,
Having a free day on my hands, I finally got around to writing some
nontrivial code in Clojure. The result happens to be a library that I
hope might be useful to someone else besides me. It's called clj-
bitfields and consists of one macro, with-bitfields, that allow you to
say things like:
(with-bitfields arr 0 {last 1, term 1, dest 22, char 8}
[last term dest char])
where `arr' is a Java array of bytes, and the map denotes names of
symbols that will be
bound to bitfields of a packed structure with given length.
The code of clj-bitfields can be found at
http://github.com/nathell/clj-bitfields/tree/master
It's MIT-licensed, so I would be happy to see it mentioned on
clojure.org/libraries.
Since this is my first Clojure library and I'm not fully accustomed
yet to doing things The Clojure Way, I'm pretty certain that some
things might have been done better. I would be extremely grateful if
someone had a look at this code and comments on how to make it more
Clojurish.
Thanks!
Daniel Janus