aboutsummaryrefslogtreecommitdiff
path: root/test/formatters/samplecode/gleam/in.gleam
blob: f0f93e95dc25fe95df3d6b5a12d8545baa7a01bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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, <<>>)
}