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

Version Path
trackler-2.2.1.159 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.158 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.157 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.156 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.155 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.154 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.153 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.152 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.151 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.150 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.149 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.148 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.147 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.146 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.145 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.144 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.143 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.142 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.141 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.140 tracks/racket/exercises/nucleotide-count/example.rkt