Sha256: e1b5b516073ddd9781f1021484b07c3d9aabc974e8a98a1e9c332645e7226af8
Contents?: true
Size: 647 Bytes
Versions: 396
Compression:
Stored size: 647 Bytes
Contents
;;; hamming.el --- Hamming (exercism) ;;; Commentary: ;;; Code: (require 'cl) (defun hamming-distance (dna1 dna2) "Determine number of mutations between DNA strands DNA1 and DNA2." (if (= (length dna1) (length dna2)) (let ((dl1 (split-string-and-unquote dna1 "")) (dl2 (split-string-and-unquote dna2 ""))) (loop with cnt = 0 for x in dl1 for y in dl2 when (not (string= x y)) do (setq cnt (1+ cnt)) finally return cnt)) (error "Strands are of different lengths"))) (provide 'hamming) ;;; hamming.el ends here
Version data entries
396 entries across 396 versions & 1 rubygems