Sha256: b3f153333ed42a055340a6208395b5800ee7c503caf1be9196140c1e0573f6b3

Contents?: true

Size: 610 Bytes

Versions: 396

Compression:

Stored size: 610 Bytes

Contents

(defpackage #:dna
  (:use #:common-lisp)
  (:export #:dna-count #:nucleotide-counts #:invalid-nucleotide))

(in-package #:dna)

(define-condition invalid-nucleotide (error) ())

(defparameter +valid-nucleotides+ "ACGT")

(defun validate-nucleotide (nucleotide)
  (or (find nucleotide +valid-nucleotides+)
      (error 'invalid-nucleotide)))

(defun dna-count (nucleotide strand)
  (validate-nucleotide nucleotide)
  (count nucleotide strand))

(defun nucleotide-counts (strand)
  (reduce #'(lambda (h c) (setf (gethash c h) (dna-count c strand)) h)
	  +valid-nucleotides+
	  :initial-value (make-hash-table)))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.179 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.178 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.177 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.176 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.175 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.174 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.173 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.172 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.171 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.170 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.169 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.167 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.166 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.165 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.164 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.163 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.162 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.161 tracks/common-lisp/exercises/nucleotide-count/example.lisp
trackler-2.2.1.160 tracks/common-lisp/exercises/nucleotide-count/example.lisp