aboutsummaryrefslogtreecommitdiff
path: root/test/formatters/samplecode
diff options
context:
space:
mode:
Diffstat (limited to 'test/formatters/samplecode')
-rw-r--r--test/formatters/samplecode/gleam/in.gleam20
-rw-r--r--test/formatters/samplecode/gleam/out.gleam13
2 files changed, 33 insertions, 0 deletions
diff --git a/test/formatters/samplecode/gleam/in.gleam b/test/formatters/samplecode/gleam/in.gleam
new file mode 100644
index 0000000..f0f93e9
--- /dev/null
+++ b/test/formatters/samplecode/gleam/in.gleam
@@ -0,0 +1,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, <<>>)
+}
diff --git a/test/formatters/samplecode/gleam/out.gleam b/test/formatters/samplecode/gleam/out.gleam
new file mode 100644
index 0000000..0e54b50
--- /dev/null
+++ b/test/formatters/samplecode/gleam/out.gleam
@@ -0,0 +1,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, <<>>)
+}