It is not yet clear what you want to do, but it seems to you that you want to know how the best block-seq block can return the number of bits filled in the last fragment. Of course, this is not possible if you want to be lazy, so the number must be returned with the last piece or after it.
Without using metadata, you can simply return a list, e.g.
(1 2 3 :pad 12)
Using metadata, you can add this additional information to the last minuses (Clojure cannot add metadata to integers), so the last minuses will be equivalent
(with-meta '(3) {:pad 12})
To get it working, the binary block must be aware of this additional information in both cases in order to be able to unlock and then redo the last fragment.
How to transfer additional information on the wire, this is another question.
source share