1 2 3 4 5 6 7 8 9 10 11 12 13
fn encode_(dna: List(Nucleotide), acc: BitArray) { case dna { [] -> acc [first, ..rest] -> { let nbit = encode_nucleotide(first) encode_(rest, <<acc:bits, nbit:size(2)>>) } } } pub fn encode(dna: List(Nucleotide)) -> BitArray { encode_(dna, <<>>) }