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.180 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.179 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.178 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.177 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.176 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.175 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.174 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.173 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.172 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.171 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.170 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.169 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.167 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.166 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.165 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.164 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.163 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.162 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.161 tracks/racket/exercises/nucleotide-count/example.rkt
trackler-2.2.1.160 tracks/racket/exercises/nucleotide-count/example.rkt