Hamming code Lassi Kortela (27 Dec 2019 19:38 UTC)
Re: Hamming code Arne Babenhauserheide (28 Dec 2019 22:21 UTC)
Re: Hamming code John Cowan (29 Dec 2019 14:28 UTC)

Re: Hamming code Arne Babenhauserheide 28 Dec 2019 22:20 UTC
Lassi Kortela <xxxxxx@lassi.io> writes:

>> I implemented a Hamming-code with Scheme last year, and I’m missing the
>> hardest part from this SRFI: How to read a file into a bitvector which
>> does not have bits that are a multiple of 8? How to write such a
>> bitvector to a file?
>
> I.e. an option to drop all the parity bits on read/write?

Something simpler: How to read a file and write it hamming-encoded?

How to read from a port and write a hamming-encoded bitstream to another
port?

How to decode (and fix) hamming-encoded data from a port and write it to
another one?

This is for teaching people networking code.

Something like:

 (match (bitvector->list (bitvector-get! readport 11))
        ((p1 p2 d3 p4 d5 d6 d7 p8 d9 d10 d11)
         (bitvector-put! writeport
             (decode-hamming-11/7 p1 p2 d3 p4 d5 d6 d7 p8 d9 d10 d11))))

Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken