Sha256: a1d04418544ce9a60aea7f89a11fa01bf1420c29300e670a348547dd539f2e02
Contents?: true
Size: 535 Bytes
Versions: 396
Compression:
Stored size: 535 Bytes
Contents
#lang racket (provide nucleotide-counts) (define (nucleotide-counts strand) (if (valid-nucleotides? strand) (map (lambda (c) (cons c (dna-count c strand))) (string->list "ACGT")) (raise-argument-error 'nucleotide-counts "strand with valid nucleotides" strand))) (define (valid-nucleotides? strand) (if (andmap (lambda (n) (member n (string->list "ACGT"))) (string->list strand)) #t #f)) (define (dna-count nucleotide strand) (length (filter (lambda (x) (char=? nucleotide x)) (string->list strand))))
Version data entries
396 entries across 396 versions & 1 rubygems