summary refs log tree commit diff stats
path: root/go/nucleotide-count/nucleotide_count.go
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-08-11 15:26:15 +0530
committerAndinus <andinus@nand.sh>2021-08-11 15:26:15 +0530
commit321825828ac918bad28d0597a8616c6dc9802c3c (patch)
tree0b8e9cb1012197750eb58e972736319b2a6abac2 /go/nucleotide-count/nucleotide_count.go
parent2979ef790ac5b8f58495e0dd08cafd6a3a2e30a5 (diff)
downloadexercism-321825828ac918bad28d0597a8616c6dc9802c3c.tar.gz
Add solved exercises
Diffstat (limited to 'go/nucleotide-count/nucleotide_count.go')
-rw-r--r--go/nucleotide-count/nucleotide_count.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/go/nucleotide-count/nucleotide_count.go b/go/nucleotide-count/nucleotide_count.go
new file mode 100644
index 0000000..1fb532c
--- /dev/null
+++ b/go/nucleotide-count/nucleotide_count.go
@@ -0,0 +1,19 @@
+package dna
+
+// Histogram is a mapping from nucleotide to its count in given DNA.
+// Choose a suitable data type.
+type Histogram
+
+// DNA is a list of nucleotides. Choose a suitable data type.
+type DNA
+
+// Counts generates a histogram of valid nucleotides in the given DNA.
+// Returns an error if d contains an invalid nucleotide.
+///
+// Counts is a method on the DNA type. A method is a function with a special receiver argument.
+// The receiver appears in its own argument list between the func keyword and the method name.
+// Here, the Counts method has a receiver of type DNA named d.
+func (d DNA) Counts() (Histogram, error) {
+	var h Histogram
+	return h, nil
+}
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242